Re: Not getting errorlevel 1 from exception
I do not think this has anything to do with WinSCP. It's your batch file syntax that is wrong. There's no
(though better is
or
See links in How do I know that script completed successfully?
and https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/if
Also you should use
if ERRORLEVEL EQ 1
. It should be:
if %ERRORLEVEL% EQU 1
(though better is
GEQ
)
or
if ERRORLEVEL 1
See links in How do I know that script completed successfully?
and https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/if
Also you should use
winscp.com
and not winscp.exe
.