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?

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.


A condition can look like that, for example:


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

Related Topics

How to edit a Batch Script

Question | 1 Answer

What is a Batch Script?

Question | 1 Answer

Batch Script is not working

Question | 1 Answer

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.


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