how to exit script in batch automation

Advertisement

pumauk
Joined:
Posts:
1

how to exit script in batch automation

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Re: how to exit script in batch automation

I guess that you are looking for:
option batch abort
See help.
_________________
Martin Prikryl

Reply with quote

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

:mrgreen:

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

What version of WinSCP are you using? Also do you use english or other version?
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum