Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

buntux

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.
martin

Should be put %1% ...
Guest

the skrypt.txt file looks like this:
option confirm off

get %1 d:\
exit
buntux

passing variable filename into the script file

Hi all,

I have simple web page which startup the batch file:

<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:

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:

< 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