Topic "how to exit script in batch automation"

Author Message
pumauk
[View user's profile]

Joined: 2005-11-23
Posts: 1
Hi

in my batch, i need to exit the script if an error occurs. I know that if there is an error, the exit code = 1. My query (as a newbie to scripting) is how do i check the exit code and tell it what to do?

I have read your forum from top to bottom, and gone through your documentation and i cant figure it out.

My script is as follows

option batch on
open user:passwd@server
cd /home/dated directory
synchronize local 'server'
close
exit

if the dated directory is not present, i need to be able to automatically close the session (my error code is 2, response is 16). Normally, it would be something like if exit code = 1 exit but i cant get the syntax

many thanks for this great program
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
I guess that you are looking for:
Code:
option batch abort

See help.
_________________
Martin Prikryl
Guest




Hi Martin - many thanks for your quick response. It works perfectly now.

I had tried help option on the command line but abort wasnt listed in the available options - and it wasnt until we had some problems at the weekend that it became an issue

anyway - many thanks for all your help

Mr. Green
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
What version of WinSCP are you using? Also do you use english or other version?
_________________
Martin Prikryl
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