Topic "passing variable filename into the script file"

Author Message
buntux

Guest


Hi all,

I have simple web page which startup the batch file:

Code:

<html>
 <head>
     <script language="JavaScript" type="text/javascript"> 
         MyObject = new ActiveXObject( "WScript.Shell" ) 
         function RunExe()   
         { 
            var filename = "test2.txt";
         var logfile = "wscplogfile.txt";
         var obj = "file:///d:/Download/winscp/wscp.bat "+filename+" "+logfile+"";
         alert(obj);
         MyObject.Run(obj); 
        } 
     
    </script>
 </head>
 <body>
    <h1>Run a Program</h1>
    <button onclick="RunExe()">Run Exe File</button>
 </body>
</html>


in my wscp.bat there is:

Code:

d:\Download\winscp\winscp.exe ge /console /script=d:/Download/winscp/skrypt.txt %1 /log=d:/%2
pause


and unfortunately it doesn't work.
The log file is creating everytime but in this log file there is a section:

Code:

< 2010-11-12 22:08:43.490 Script: Active session: [1] ge
> 2010-11-12 22:08:43.490 Script: option confirm off
< 2010-11-12 22:08:43.490 Script: confirm         off       
> 2010-11-12 22:08:43.491 Script: get %1 d:\
. 2010-11-12 22:08:43.492 Listing file "%1".


why this doesn't work for a filename?

how I can pass the variable filename from my webpage into the skrypt.txt file
Advertisements
Guest




the skrypt.txt file looks like this:
Code:

option confirm off
get %1 d:\
exit
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Should be put %1% ...
_________________
Martin Prikryl
buntux

Guest


Thanks for the response.

I managed do do it by generating skrypt.txt file by webpage.
This is better sollution because only webpage knows what will be the file name.

Regards.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License