00 Votes

Abort Windows Batch Script

Question by Guest | 2016-11-06 at 16:57

Is there any possibility to quit, cancel or abort a Windows Batch Script (.BAT) out of itself? I have some conditions in my script after which I want to discontinue the further script processing in some cases.

Can someone help me? Is there any command for that?

ReplyPositiveNegative
0Best Answer0 Votes

The command you are searching for is EXIT. Just write EXIT into your batch script and the script will be canceled at this point.

EXIT

A condition can look like that, for example:

IF NOT EXIST file.txt EXIT

Here the script is discontinued in case that the file "file.txt" is not existing.

If you should have started your batch script out of another batch file, and if you only want to abort the current script and not the calling script, this question should be interesting for you.
2016-11-07 at 14:44

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.