Calling another batch program from a batch program.
CALL filename
batch-parameters Specifies command-line information needed by the batch program.
If command extensions are enabled, CALL changes as follows:
The CALL command now accepts labels as targets for CALL. The syntax is:
CALL:label arguments
A new batch file context is created with the specified arguments, and control is passed to the statement after the label is specified. You must "exit" twice by reaching the end of the batch script twice. The first time the end of the file is read, control returns to immediately after the CALL statement. The second time exits the batch script. Type GOTO /? to see the description of the GOTO : EOF extension, which allows you to return from a batch script.
In addition, batch script text parameter references (%0, %1, etc.) have changed as follows:
%* in a batch script indicates all parameters (such as %1 %2 %3 %4 %5 ...)
Substitution of batch parameters (%n) has been enhanced. You can use the following syntax:
%~1 - Remove quotes ("
and expand %1
%~f1 - Expand %1 to a fully qualified pathname
%~d1 - Expand %1 to just a drive letter
%~p1 - Expand %1 to just a path
%~n1 - Expand %1 to just a filename
%~x1 - Expand %1 to just a file extension
%~s1 - Expanded path contains short names
%~a1 - Expand %1 to file attributes
%~t1 - Expand %1 to file date/time
%~z1 - Expand %1 to file size
%~$PATH:1 - Search directories listed in the PATH environment variable and expand %1 to the first fully qualified name found. If the environment variable name is not defined or the file is not found, this combination expands to an empty string
You can combine modifiers to get multiple results:
%~dp1 - Expand %1 to just drive letter and path
%~nx1 - Expand %1 to just filename and extension
%~dp$PATH:1 - Search directories listed in the PATH environment variable for %1 and expand to the drive letter and path of the first file found.
%~ftza1 - Expand %1 to a DIR-like output line.
In the above examples, %1 and PATH can be replaced with other valid values. The %~ syntax is terminated by a valid parameter number. %~ modifiers cannot be used with %*
CALL filename
batch-parameters Specifies command-line information needed by the batch program.
If command extensions are enabled, CALL changes as follows:
The CALL command now accepts labels as targets for CALL. The syntax is:
CALL:label arguments
A new batch file context is created with the specified arguments, and control is passed to the statement after the label is specified. You must "exit" twice by reaching the end of the batch script twice. The first time the end of the file is read, control returns to immediately after the CALL statement. The second time exits the batch script. Type GOTO /? to see the description of the GOTO : EOF extension, which allows you to return from a batch script.
In addition, batch script text parameter references (%0, %1, etc.) have changed as follows:
%* in a batch script indicates all parameters (such as %1 %2 %3 %4 %5 ...)
Substitution of batch parameters (%n) has been enhanced. You can use the following syntax:
%~1 - Remove quotes ("
and expand %1%~f1 - Expand %1 to a fully qualified pathname
%~d1 - Expand %1 to just a drive letter
%~p1 - Expand %1 to just a path
%~n1 - Expand %1 to just a filename
%~x1 - Expand %1 to just a file extension
%~s1 - Expanded path contains short names
%~a1 - Expand %1 to file attributes
%~t1 - Expand %1 to file date/time
%~z1 - Expand %1 to file size
%~$PATH:1 - Search directories listed in the PATH environment variable and expand %1 to the first fully qualified name found. If the environment variable name is not defined or the file is not found, this combination expands to an empty string
You can combine modifiers to get multiple results:
%~dp1 - Expand %1 to just drive letter and path
%~nx1 - Expand %1 to just filename and extension
%~dp$PATH:1 - Search directories listed in the PATH environment variable for %1 and expand to the drive letter and path of the first file found.
%~ftza1 - Expand %1 to a DIR-like output line.
In the above examples, %1 and PATH can be replaced with other valid values. The %~ syntax is terminated by a valid parameter number. %~ modifiers cannot be used with %*




