Post a reply

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)


Topic review


Great, it's exactly what I was looking for!

Yes, I know, for hostkey

Thank you!

Re: Get return code of "call"

WinSCP returns exit code 1 (by default), when the command returns exit code >= 2. You can make WinSCP return 1 even if the command returns 1, by setting ExitCode1IsError raw session setting:
open scp://root:strongPassword@ -hostkey=* -rawsetting ExitCode1IsError=1

But you cannot make WinSCP return the actual exit code of the command.
WinSCP is not the right tool for automating remote shell command execution.
Use Plink instead.

Btw, combination of "strongPassword" and -hostkey=* is just wrong. You are possibly sending your "strong password" right to the hands of an attacker.

Get return code of "call"


I'm using and I'm trying to get the return code of commands called with call
Basically, I launch the following command /script=./script.txt /parameter 'foo' 'bar'

With the script file which looks like
open scp://root:strongPassword@ -hostkey=*
call /root/ %1% %2%

But even if /root/ %1% %2% returns 1, returns 0. I grabbed the return code of with %ERRORLEVEL%

How can I do that?

Thank you!