Call invokes another batch program from one batch program and does not terminate the parent batch program. _dos/bat
Source: Internet
Author: User
Call
Calls another batch program from one batch program and does not terminate the parent batch program. The call command accepts the label used as the calling target. If you use call outside of a script or batch file, it will not work on the command line.
Parameters
[Drive:} [Path] FileName
Specifies the location and name of the batch program to invoke. The filename parameter must have a. bat or. cmd extension.
Batchparameters
Specifies any command-line information required by the batch program, including command-line options, file names, batch parameters (from%0 to%9) or variables (for example,%baud%).
: Label
Specifies the label to which the batch program jumps. Use the call command with this parameter to create a new batch file context and give control to the statement after the specified label. When the end of the batch file is first encountered (after jumping to the label), control is returned to the statement after the call statement. The second time the end of the batch file is encountered, the batch script is exited. For a description of the goto:eof command that allows you to return from a batch script, see.
Arguments
For a batch program that starts with a label, specifies the command line information to be routed to its new instance, including command-line options, file names, batch parameters (from%1 to%9), or variables (such as%baud%).
/?
Display Help at the command prompt.
Comments
Working with batch Parameters
Batch parameters can contain any information that is passed to a batch 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.
Using piping and redirection symbols
Do not use pipes and redirection symbols in the call command.
Making a recursive call
You can create a batch program that invokes itself, but you must provide an exit condition. Otherwise, the parent and child batch programs can loop indefinitely.
Using Command Extensions
If you enable command extensions (that is, by default), call accepts the label parameter as the calling 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 program, type the following command in the parent batch program:
Call Checknew
If the parent batch program accepts two batch parameters and expects it to pass these parameters to Checknew.bat, you can use the following command in the parent batch program:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.