Go to the GdP Software main page
GdP Software
Contact
Shop
Products
Faq

back Directory Monitor, watchDirectory, automatically start command when folder contents change.

Using CALL inside a .bat file

The CALL statement allows you to have a subroutine inside your .bat file. Unlike the GOTO statement that jumps to a label in your .bat file, the CALL statement remembers where it came from, and can return there.

A simple example

		 ECHO before call
		 Call :Sub
		 ECHO Back from sub
		 GOTO :EOF

		 :Sub
		 ECHO in sub
		 GOTO :EOF

The output from the previous example would be:

before call
in sub
Back from sub

To finish a subroutine, and thereby returning to the statement following the CALL, you need to "GOTO :EOF". EOF is short for "End Of File", so executing the statement GOTO :EOF will quit your .bat file. If the "GOTO :EOF" is done while a CALL is active, it will not quit your .bat file but return to the statement following the active CALL.

back