Problem passing/reading argument in Script file
Hi,
I have started using winscp for ftping file to a secure ftp site. since we have lots of files to ftped to diff ftp server in future , i wrote a script file which will accept argument passed in command line..
Here is the script :
---------------------------------- SFTP_Script.txt
option batch on
option confirm off
open %1% -hostkey=%2%
put %3%
exit
----------------------------------
My command line is like this :
winscp.com /script=SFTP_Script.txt /parameter "sftp://{username}:{passwd}@{servername}" /parameter "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" /parameter ":\data\test_sftp.txt"
When i run this command line , i get the error message :
----------------------------------error msg
Searching for host...
Host does not exist
batch on
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "ftp_rptsvcs".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftp_rptsvcs@10.254.4.170
File or folder '%3' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
-----------------------------------
Not sure what the reason for the error is. can anyone please help me on this
PS :
But when i run the following script from command line , where i do have only 2 arguments , it runs perfectly.
-------------------------------SFTP_Script_old.txt
option batch on
option confirm off
open %1% -hostkey=%2%
put c:\data\test_sftp.txt
exit
-------------------------------
I have started using winscp for ftping file to a secure ftp site. since we have lots of files to ftped to diff ftp server in future , i wrote a script file which will accept argument passed in command line..
Here is the script :
---------------------------------- SFTP_Script.txt
option batch on
option confirm off
open %1% -hostkey=%2%
put %3%
exit
----------------------------------
My command line is like this :
winscp.com /script=SFTP_Script.txt /parameter "sftp://{username}:{passwd}@{servername}" /parameter "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" /parameter ":\data\test_sftp.txt"
When i run this command line , i get the error message :
----------------------------------error msg
Searching for host...
Host does not exist
batch on
confirm off
Searching for host...
Connecting to host...
Authenticating...
Using username "ftp_rptsvcs".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] ftp_rptsvcs@10.254.4.170
File or folder '%3' does not exist.
System Error. Code: 2.
The system cannot find the file specified
(A)bort, (R)etry, (S)kip, Ski(p) all: Abort
-----------------------------------
Not sure what the reason for the error is. can anyone please help me on this
PS :
But when i run the following script from command line , where i do have only 2 arguments , it runs perfectly.
-------------------------------SFTP_Script_old.txt
option batch on
option confirm off
open %1% -hostkey=%2%
put c:\data\test_sftp.txt
exit
-------------------------------