passing variable filename into the script file

Advertisement

buntux
Guest

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Should be put %1% ...
_________________
Martin Prikryl

Reply with quote

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.

Reply with quote

Advertisement

You can post new topics in this forum