Thursday, November 25, 2021

Windows batch file: goto vs call

In a Windows batch file, goto label2 command goes to the label2 and continues from the end of label2. call :label2 goes to label2 and after seeing a exit /b (or end of script, eof), returns back right after the call command. In other words, call behaves like a function call in Java, C++ etc. but you have to use exit /b instead of return.

No comments:

Post a Comment