Call
From one batch Program Call another batch processing program without terminating the parent batch processing program. The Call Command accepts the labels used as the call target. If a call is used outside a script or batch file, it does not work in the command line.
Syntax
Call [[drive:] [path] filename [batchparameters] [: Label [arguments]
Parameters
[Drive:} [path] filename
Specifies the location and name of the batch processing program to be called. The filename parameter must have the. bat or. CMD extension.
Batchparameters
Specifies any command line information required by the batch processing program, including command line options, file names, batch processing parameters (from % 0 to % 9), or variables (for example, % baud % ).
: Label
The tag to be jumped to by the batch processing program. You can use the call command with this parameter to create a new batch processing file context and give control to the statement after the specified tag. When the end of the batch processing file is first met (after the tag is jumped to), the control is returned to the statement after the call statement. The second time you encounter the end of the batch file, the batch script will be exited. For the Goto: EOF command extensions that allow you to return from the batch processing script, see "" for instructions on them.
Arguments
For a batch processing program with the label header, specify the command line information to be sent to its new instance, including command line options, file names, batch processing parameters (from % 1 to % 9) or variable (such as % baud % ).
/?
Display help at the command prompt.
Note
Use Batch Processing Parameters
Batch parameters can contain any information sent to the batch processing program, including command line options, file names, batch parameters (from % 1 to % 9), or variables (for example, % baud % ). For more information about batch parameters, see "".
Use pipelines and redirection symbols
Do not use pipelines and redirection symbols in the call command.
Send recursive call
You can create a batch program to call your own, but you must provide exit conditions. Otherwise, the parent and sub-batch processing programs can have infinite loops.
Use command Extension
If you enable command extension (by default), call accepts the label parameter as the call target. The correct syntax is as follows:
Call: Label arguments
For more information about enabling and disabling command extensions, see CMD in.
Example
To run the checknew. Bat program from another batch, type the following command in the parent batch:
Call checknew
If the parent batch processing program accepts two batch processing parameters and wants it to pass these parameters to checknew. bat, you can use the following command in the parent batch processing program:
Call checknew % 1% 2
Xox