% ~ x1 Expand only % 1 file name extension. % ~ s1 Expand % 1 to a qualified path containing only short names. % ~ a1 Expand % 1 to file attribute. % ~ t1 Expand % 1 to the date and time of the file. % ~ z1 Expand % 1 to the size of the file. % ~ $ PATH: 1 Search for the directories listed in the PATH environment variable and expand % 1 to the full name of the first directory found. If the environment variable name is not defined or the file is not found, this modifier will expand to an empty string.
The following table shows how you can combine modifiers with batch parameters to produce the following concatenation results:
Batch parameter with modifier Description% ~ dp1 Only expand % 1 to drive letter and path. % ~ nx1 Only expand % 1 to file name and extension. % ~ dp $ PATH: 1 Search for the directories listed in the PATH environment variable for % 1, and then expand to the drive letter and path of the first directory found. % ~ ftza1 Expand % 1 to display the output similar to the dir command .In the above examples, % 1 and PATH can be replaced with other valid values. The syntax % ~ is ended with a number of valid arguments. Cannot use modifiers % ~ with % *.
The batch parameters can contain any information that you can convert to a batch program, including command line options, file names, batch parameters from% 0 to% 9 and variables (eg% baud%).
By using the call command with the Label parameter, you will create a new context for the batch file and pass control to the command after the specified label. The first time the executable file ends (that is, after jumping to label), a statement is returned after the call statement. The second time the executable file ends, the batch script will exit.
Do not use characters (|) and navigation symbols () with the call command.
You can create a batch program that calls itself. However, you must provide an exit condition. Otherwise, the original batch programs and subroutines can form non-stop loops.
If the command extension is enabled, the call command accepts the label as the target of the command. The syntax is exactly as follows:
call:
To run Checknew.bat from another batch program, type the following command into the original batch program:
call checknew
If the original batch accepts two batch parameters and you want it to pass those parameters to Checknew.bat, type the following command in the original batch program:
call checknew% 1% 2
See more: