Topic "Return Code 33"

Author Message
cntrykck
[View user's profile]

Joined: 13 Nov 2013
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"
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
log_snippit.txt (1.75 KB) [Download]

Description: (none)

prikryl
[View user's profile]
Site Admin
Joined: 10 Dec 2002
Posts: 19344
Location: Prague, Czech republic
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
cntrykck
[View user's profile]

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

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License