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

aceinc

Passing parameters to script file...

I have a command procedure which calls a separate command procedure to execute WinSCP. So the top level command procedure calls SFTP-Put-WinSCP.cmd like;
SFTP-Put-WinSCP.cmd 20201210-183003

The file SFTP-Put-WinSCP.cmd looks like;
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /script="D:\MyFolder\SFTPPutScript.txt" /loglevel=0 /log=D:\FCDSLexisNexis\Log\WinSCPPut.log"

SFTPPutScript.txt Looks like;
open "sftp://MyUser:MyPassword@My.SFTPDomain.com/"
put D:\MyFolder\RequestFiles\MyRequest-%1.txt incoming/MyRequest-%1.txt
exit

I am expecting to send the file D:\MyFolder\RequestFiles\MyRequest-20201210-183003.txt to the remote server, but I get an error message;
File or folder 'D:\MyFolder\RequestFiles\MyRequest-%1.txt incoming/MyRequest-%1.txt' does not exist. ("System Error. Code: 2.

I am sure I am not passing parameters correctly. When I add the /parameter switch using either space or equals sign it stops writing to the log and it doesn't send the file. One example of what I tried is;
"C:\Program Files (x86)\WinSCP\WinSCP.exe" /script="D:\FCDSLexisNexis\SFTPPutScript.txt" /loglevel=0 /log=D:\FCDSLexisNexis\Log\WinSCPPut.log" /parameter %1

So the question is, where can I find good examples doing what I need to do?