Topic "Return Code 33"

Author Message
[View user's profile]

Joined: 2013-11-13
Posts: 4
Location: Rockville, MD
I am using a command file to execute this script:
"C:\Program Files (x86)\WinSCP\winscp" /script="C:\BackuptoNAS\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

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
log_snippit.txt (1.75 KB) [Download]

Description: (none)

[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
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).
Martin Prikryl
[View user's profile]

Joined: 2013-11-13
Posts: 4
Location: Rockville, MD
Thank you prikryl, that did the job. Now my script is acting the way that it should.

You can post new topics in this forum


What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License