Reputation: 210515
What is the equivalent of the return
statement for a batch file subroutine?
Upvotes: 38
Views: 40964
Reputation: 1123
Goto :Eof
Exit
Goto :Eof usually use in call command such as:
@echo off
call :Hi
pause&exit
:hi
echo Hello!
goto :eof
Upvotes: 3
Reputation: 67216
I think that it is:
exit /b [exitCode]
Not just because it is more understandeable to use, but also because exit /b (and just exit also) may return an exitCode (ERRORLEVEL) value to the caller program.
In my modest opinion, goto :eof is a strange patch that should not be used...
Upvotes: 27
Reputation: 993223
It is:
goto :eof
This is understandably unusual for somebody accustomed to normal programming languages.
I found this info here.
Upvotes: 37