Using CALL for labels in a batch script
Why not just run it and see for yourself? I saved your script to a batch file called foo.bat, and I changed the Your mom goes to college.
to have an echo
in front.
C:\temp>foo
C:\temp>ECHO It's for my college fund.
It's for my college fund.
C:\temp>CALL :OMGSUB
C:\temp>echo Your mom goes to college.
Your mom goes to college.
C:\temp>GOTO:eof
C:\temp>ECHO *runs away and cries like a little girl*
*runs away and cries like a little girl*
C:\temp>echo Your mom goes to college.
Your mom goes to college.
C:\temp>GOTO:eof
C:\temp>
So it's easy to see that after the OMGSUB
is called, it
- Goes to the end of file.
- Then it returns to the line right afer the
CALL :OMGSUB
and echos the "runs away" line - Then it echos the Your Mom line again
- Then it goes to end of file and terminates
- The line
echo *picks up jewewlry box*
never gets reached.