Continue calling Batch Script after EXIT
Question by Guest | 2016-05-05 at 08:05
I am using the EXIT command in a Windows Batch Script (.BAT) in order to abort the script under certain circumstances.
Taken by itself this is working quite well. However, my script is called by another superior superordinate script and as soon as the EXIT command has been executed, also the calling script stops and not only the current one.
What can I do to only cancel the subordinate script and to keep the calling script file running?
Related Topics
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
Windows Batch Script: Computer Shutdown
Tutorial | 0 Comments
jQuery: Submit complete form and receive content with Ajax
Tutorial | 0 Comments
jQuery: Send HTML5 Canvas to Server via Ajax
Tutorial | 0 Comments
PHP: Abort within include - continue remaining script
Question | 1 Answer
Batch Script: Start program and wait until it is finished
Question | 2 Answers
Close Batch-Script-Window after Program Start
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.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
With the command EXIT you finish the complete CMD.EXE and not only the execution of the current batch file.
For only canceling the current batch file or the subroutine, you can just pass the parameter /B and write "EXIT /B" instead of "EXIT" only:
By the way, you can also optionally pass an error code behind /B which is then reported to the superior calling script. For example, you can write "EXIT /B 10" for passing the error code "10".
2016-05-05 at 16:11