Call calls from one batch program to another without terminating the parent batch program.

Time:2021-7-31

Call
Calls from one batch program to another without terminating the parent batch program. call   Command accepts the label used as the call target. If used outside a script or batch file   Call, which will not work on the command line.

grammar
call [[Drive:][Path] FileName [BatchParameters]] [:label [arguments]]

parameter
[Drive:}[Path] FileName 
Specify the location and name of the batch program to call. filename   Parameter must have  . bat   or  . cmd   Extension.  
BatchParameters 
Specify any command line information required by the batch program, including command line options, file names, batch parameters (from  % 0   reach  % 9) Or variables (for example,% baud%).  
:label 
Specifies the label to which the batch program jumps. Use with this parameter   call   Command can 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 tag), control is returned to the   CALL   Statement after the statement. The second time you encounter the end of the batch file, the batch script will be exited. For that allows you to return from a batch script   goto  : eof   For a description of the command extension, see “.”.  
arguments 
For  : label   The beginning batch program specifies the command line information to be passed to its new instance, including command line options, file name, batch parameters (from  % one   reach  % 9) Or variables (e.g  % baud%)。  
/? 
Displays help at the command prompt.  
notes
Using batch parameters  
Batch parameters can contain any information passed to the batch program, including command line options, file names, batch parameters (from  % one   reach  % 9) Or variables (for example,% baud%). For more information about batch parameters, see.

Using pipes and redirection symbols  
Don’t be   call   Use pipes and redirection symbols in commands.

Issue recursive call  
You can create a batch program that calls itself, but you must provide an exit condition. Otherwise, the parent and child batch programs can loop indefinitely.

Using command extensions  
If command extension is enabled (that is, by default), call   Will accept   label   Parameter as the call target. The correct syntax is as follows:

call :label arguments

For more information on enabling and disabling command extensions, see in   cmd。

example
To run from another batch program   Checknew.bat   Program, type the following command in the parent batch program:  

call checknew 

If the parent batch program accepts two batch parameters and wants it to pass them to   Checknew.bat, you can use the following command in the parent batch program:  

call checknew %1 %2 

XOX 

Recommended Today

OC basis

IOS development interview essential skills chart.png What are objects and what are the objects in OC? An object is an instance of a class; Is an instance created through a class, which is generally called an instance object; Common objects in OC include instance objects, class objects, and metaclass objects; What is a class? What […]