winkey+R
cmd
the call command
Help for the call command:
Calls one batch program from another batch program.
CALL filename
batch-parameters Specifies the command-line information required by the batch program.
If command extensions are enabled, CALL changes as follows:
The CALL command now accepts labels as the target of CALL. The syntax is:
CALL:label arguments
A new batch file context is created by the specified arguments, and control is passed to the statement after the specified label. You must "exit" twice by reaching the end of the batch script file twice. The first time the end of file is read, control will return to the line right after the CALL statement. The second time will exit 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 parameter references (%0, %1, etc.) have been changed as follows:
%* in a batch script indicates all the parameters (such as %1 %2 %3 %4 %5 ...)
Substitution of batch parameters (%n) has been enhanced. You can use the following syntax:
%~1 - removes any surrounding quotes("), expanding %1
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - the expanded path contains short names only
%~a1 - expands %1 to file attributes
%~t1 - expands %1 to the file date/time
%~z1 - expands %1 to the file size
%~$PATH : 1 - searches the directories listed in the PATH environment variable, and expands %1
to the first fully qualified name found. If the environment
variable name is not defined, or the file is not found, this key combination will
expand to an empty string
Modifiers can be combined to get multiple results:
%~dp1 - expands %1 to the drive letter and path only
%~nx1 - expands %1 to the file name and extension only
%~dp$PATH:1 - searches for %1 in the directories listed in the PATH environment variable,
and expands to the drive letter and path of the first file found.
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 %*.
[ Last edited by 676939481 on 2010-9-18 at 11:30 ]