Thank you prikryl, that did the job. Now my script is acting the way that it should.
Just append some noop command after mount
to suppress the error code, e.g.:
call mount nasa:/vol/backup/admws01 /backup_admws1 ; echo
If you need to suppress only code 33
you need to use something smarter (like if
command).
I am using a command file to execute this script:
"C:\Program Files (x86)\WinSCP\winscp" /script="C:\BackuptoNAS\tokenCheck01.cmd"
tokenCheck01.cmd
-----------------
option batch on
option confirm off
open sftp://user:password@server:22 -passive
option transfer binary
option synchdelete off
call mount nasa:/vol/backup/admws01 /backup_admws1
ls /backup_admws1
close
exit
-----------------
When the script attempts to mount the remote file system, it receives a RETURN CODE of 33 if the remote file system is already mounted, but it is able to continue on and complete the next command in the sequence - ls.
I want to be able to capture the RETURN CODE (not the %errorlevel%) so that I can continue with normal path processing instead of going down the failover path. The %errorlevel% is set to '1' whether it has this RETURN CODE or the script cannot successfully log into the server.
Attached is a snippit of the log showing the above.
Thanks for any assistance