02 May 2019 08:45
PiotrMP006
Hi
How to better end batch script exit / b or goto: eof?
----------------------------
#2 02 May 2019 09:45
bluesxman
If you need to set the ERRORLEVEL for the script (or a subroutine) then you should use exit /b [number].
Otherwise they are pretty much interchangeable in my experience (happy to be corrected on this though) – so use whichever you prefer the look of I guess.
Last edited by bluesxman (02 May 2019 09:45)
cmd | *sh | ruby | chef
----------------------------
#3 02 May 2019 20:48
Aacini
I used to end subroutines (called by call) via exit /B, and end the main program (called at the command-prompt) via goto :EOF
Antonio
Last edited by Aacini (02 May 2019 20:49)
----------------------------
#4 03 May 2019 10:57
Simon Sheppard
Other than being able to return an ERRORLEVEL, I think that the only difference is that EXIT will work even if Command Extensions are disabled, thats a pretty rare edge case though.
How to better end batch script exit / b or goto: eof?
- MigrationUser
- Posts: 336
- Joined: 2021-Jul-12, 1:37 pm
- Contact: