Script ERRORLEVEL not working as expexted
Hi,
We are trying to transfer some files to client FTP server and it needs to stop transfer whenever it detects an error (client FTP server is not stable).
We use a batch script like this:
We are trying to exit the script completely if the
In the logs we can see errors like
Thanks and appreciate your help!
We are trying to transfer some files to client FTP server and it needs to stop transfer whenever it detects an error (client FTP server is not stable).
We use a batch script like this:
cd /d %~dp0 ".\WinSCP\WinSCP.exe" /script=.\FTP_Outbound.txt /log=.\FTP_Outbound_log.txt /logsize=5*10M if %ERRORLEVEL% NEQ 0 ( echo WinSCP transfer failed. Files will not be moved. exit /b %ERRORLEVEL% ) cd /d D:\Exports\ rem Move files to Backup folder: move /Y *.* Backup
ERRORLEVEL
is not equal to 0 but it never work as expected. Please advise.
In the logs we can see errors like
which might not return asTimeout detected. (control connection)
Connection failed.
ERRORLEVEL
other than 0 I assume?
Thanks and appreciate your help!