CALL

RECENT NEWS

12/18/2015 - Hello! We're excited to announce that Mental Works Computing Software will soon be featuring

12/11/2015 - We're going to announce Dr.Batcher 3.0 Alpha with batch files debugger support soon. If you want to start...

News history...

TESTIMONIALS

Rob van der Woude:
"Mental Works Computing Software has created a nice tool for...

Andrew Jaritsyn:
“I used to write batch files with the help of Notepad, but...

Steve H.:
“This tool helped me to write some batch files in a couple...

More...

CALL

Calls a batch file from another batch file or jumps to the label into current batch file.

Syntax:

CALL FileName [BatchParameters]

or

CALL :Label [Arguments]

FileName – the name of the batch file to be called. If this file is not placed in folders that belong to PATH environment variable.

BatchParameters – parameters that should be passed to the calling batch file.

:Label – the name of the label you want to jump to.

Arguments – the arguments you want to pass to the code starting from the label.

Usage:

You can run batch files from your script without CALL command, but in this case the execution of your batch file won’t continue after running another script.

To end batch file execution from subroutine starting from label you should use GOTO :EOF. In the other case the execution will return to the line after CALL command.

You can call batch files recursively but you should provide an exit condition.

Parameters passing to CALL command can be written in a direct way or by using variables (see examples).

Examples:

Calling an external batch file with directly written arguments:

CALL mybat.cmd x:\Folder\File1

Calling an external batch file with variables as arguments:

CALL mybat.cmd %pathname%

Calling an internal subroutine (jumping to the label):

CALL :calculate 10 %amount%

 

Subscribe batch files programming newsletter (no spam):

Subscribe

Unsubscribe