I have two different servers (A and B, both are Windows) and I am executing putty via command line between them. Server A executes remotely an script in server B and everything works fine, but I am not able to get the output (ERRORLEVEL) in server A once the script has been executed in server B. I mean, I can get the output but always says that the process has finished successfully even if the process in server B has failed.
I attach an small example of the process (ExProcess.bat) I have in server B:
set LOG_PATH=C:\Project\Logs set BIN_PATH=C:\Project\bin cd %BIN_PATH% C: echo %date% %time% >> %LOG_PATH%\logfile.txt EXECUTE_MY_COMMAND >> %LOG_PATH%\logfile.txt if not %ERRORLEVEL%==0 exit %ERRORLEVEL%
And this is how I am making the remote call from server A:
putty -ssh server02 -P 22 -l user1 -pw password1 -m C:\Project\SSH_PRG0001_CMPG0001.txt
SSH_PRG0001_CMPG0001.txt contains the remote batch (C:\ExProcess.bat)
If I execute in Windows Command line %ERRORLEVEL% once I have executed the putty command I am not getting the correct output of the process I have run remotely.
I have checked that the remote process is returning the correct output error in server B, but my problem is that I cannot get this output from server A.
Thanks for your help