Issues catching return code and %ERRORLEVEL%
Hi Martin and all,
I got myself into trouble trying to catch the return code from
My script works fine but when I'm trying to make the winscp part fail (for testing purposes,
My script looks like this:
I'm guessing it's because winscp itself returns a 0, because when i'm looking at the log, there is no "Script : Exit code: X" as you can see.
I tried the same using
Any ideas what's wrong with my script? Or am I misunderstanding the way WinSCP deals with failed connection?
Thanks.
I got myself into trouble trying to catch the return code from
winscp.com
(latest version 5.18.5).
My script works fine but when I'm trying to make the winscp part fail (for testing purposes,
@IP
is voluntarily a false one), it indeed fails (connection fails) but still returning %ERRORLEVEL%=0
My script looks like this:
"%repdev%\WinSCP.com" ^ /log="%replog%\FTP_%soc%_%tagdate%.log" /loglevel=2* /logsize=10*10M ^ /command ^ "option batch abort" ^ "open ftp://root:XXXXXXX@120.1.1.1/" ^ "cd /ud/tmp/LBE" ^ "put -transfer=binary PDF%soc%.001" ^ "put -transfer=binary PDF%soc%.flw" ^ "exit" if %ERRORLEVEL% NEQ 0 GOTO :ERREUR_FTP
I tried the same using
/script
with a txt instead of /command
but the result is the same.
Any ideas what's wrong with my script? Or am I misunderstanding the way WinSCP deals with failed connection?
Thanks.