Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Put double quotes around parameter references, particularly around %2%.
Arun

Thanks for your reply. I tried as u said :


winscp.com /script=SFTP_Script.txt /parameter "sftp://{username}:{passwd}@{servername}" "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" "c:\data\test_sftp.txt"

If i run the above command line , i get the following error msg.
--------------------------------------------------------------------
batch on
confirm off
Too many parameters for command 'open'.
No session.
--------------------------------------------------------------------

we should put /parameter for each argument we pass?
martin

Re: Problem passing/reading argument in Script file

Use the /parameter switch only once.
Arun

small correction to my post. 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 "c:\data\test_sftp.txt"


corrected stated the 3rd argument.


Thanks,
Arun
Arun

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