Using Winscp.com in a Batchfile with Escape characters

Advertisement

Moriarty91
Joined:
Posts:
1

Using Winscp.com in a Batchfile with Escape characters

Hello!
I am writing a batchfile to automatically upload a file to an sftp-server.
Using the following code works fine:
 C:\patch\to\winscp.com /log="C:\path\winscp.log" /loglevel=1 /command ^
"open user@sftp.psubdomain.server.com -privatekey=C:\path\key.ppk -hostkey=XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX" "put -resume -resumesupport=on -transfer=binary -delete C:\path\%filename%.ext users/name/path/" "exit"

But using the following code which I have copied from the documentation produces errors:
C:\patch\to\winscp.com /log="C:\path\winscp.log" /loglevel=1 ^
     "open user@sftp.psubdomain.server.com -privatekey=C:\path\key.ppk -hostkey=XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX" ^
     "put -resume -resumesupport=on -transfer=binary -delete C:\path\%filename%.ext users/name/path/" ^
     "exit"
I have copied the codesample above from the documentation and WinSCP either says "Unknown command: ^" after executing the "open ..." line (so the second ^ is not recognized) and the following WinSCP-commands "put..." and "exit" are then interpreted by cmd in the batch file and not WinSCP as part of its commands.
The other error I get from WinSCP is "Unknown command: open user@sftp.psubdomain.server.com -privatekey=C".
I have not figured out, which error is triggered when and I don't know what is wrong as the logfile simply seems to repeat these errors.
Thanks for your help!
Moriarty91

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum