thanks worked like a charm !
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
winscp.exeis a GUI application. PowerShell does not seem to wait for GUI application to exit before proceeding to the next comment. So the
$LASTEXITCODEcannot contain the exit code as the application has not exited yet. Use
winscp.cominstead, what is a console application.
winscp.exe /console /script=test1.txt /log=ftp.log
winscp.exe /console /script=test2.txt /log=ftp.log
Press any key to continue . . .
.\winscp.exe /console /script=test1.txt /log=ftp.log
.\winscp.exe /console /script=test2.txt /log=ftp.log
. 2014-01-15 12:24:51.561 Script: Failed
. 2014-01-15 12:24:51.561 Script: Exit code: 1
. 2014-01-15 12:24:51.561 Disconnected from server
< 2014-01-15 12:24:51.567 226 Closing data connection