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

Re: Pass 2 parameters to WinSCP

You have probably takes the %1% syntax from the description of the WinSCP script syntax. But note that in your case, you are passing the %1% on the command-line, not in the script. In this case it is resolved by the Windows shell, which has syntax %1 only. So you end up with %1 references to the first parameter of the .bat file, and %" "put % reference to non-existing (and invalid) environment variable. So change %1% to %1. Though you still have a problems with quoting. If there are no spaces in the value of %1, avoid using quotes when running the .bat file.
sotn100

Pass 2 parameters to WinSCP

I need to run winscp as a process task from SSIS passing in the sftp server connection details and the file to send. I am trying to run this from a command prompt before integrating with SSIS.
To start with I am passing 1 parameter, so I have a batch file (X1A) that contains the line
winscp /command "option batch on" "option confirm off" "open sftp://user:password@server:22" "put %1%" "exit"
Then from command prompt I enter the command x1a file.txt
And it sends the file with no trouble
If I changed the batch file to replace the connection information with %1% and the %1% with %2" so I get this
winscp /command "option batch on" "option confirm off" "open %1%" "put %2%" "exit"
then ran the command x1a "sftp://user:password@server:22" "file.txt"
The command fails and displays
winscp /command "option batch on" "option confirm off" "open "sftp://user:password@server:22"2" "exit"
How do I pass 2 paramaters to winscp?