I'm working on some Windows .bat
files that have been around for a long time. On their last line, they have a single exit
statement without arguments.
This appears to be completely redundant to me. Is there any valid reason for their presence?
I'm working on some Windows .bat
files that have been around for a long time. On their last line, they have a single exit
statement without arguments.
This appears to be completely redundant to me. Is there any valid reason for their presence?
An exit
withoput /b
option will exit batch file and the cmd.exe instance.
When you start the batch file by starting it from the explorer, there is not difference,
but when you start the batch file from a cmd window, the window closes when the batch file executes the exit
.
Normally you should avoid this, as it's annoying behaviour, you can't build another batch file calling this type of files, as the exit
also cancels the calling batch file.
call myAnnoyingBatch.bat
echo This won't be displayed anymore
I only know one good reason for using exit
at the end of a script.
When you build a drag&drop script that should be bullet proof , you need an exit to avoid problems with some filenames like cat&dog.png