Functions of symbols in DOS batch processing
@
\ Hide command echo.
~
\ In for, the extended variable is used;
Indicates the string at the specified position using the extended environment variable in set;
In set/a, it indicates bitwise inversion.
%
\ Two % contain a string to reference the environment variable. For example, a % time % can be extended to the current system time;
A single % followed by a number 0-9 indicates that the command line parameter is referenced;
Used to reference cyclic variables in;
The two consecutive % indicates that the execution is taken off as one %.
^
\ Cancel the escape character to disable the escape function of all escape characters. For example, if you want to display some special characters on the screen, such as >>| ^, you can add a ^ symbol before it to display the characters following this ^, ^ indicates displaying a ^, ^ | indicates displaying a | character;
In set/A, it is bitwise;
In findstr/R [], it indicates that the specified character set does not match.
&
\ Command connection character. For example, if you want to execute two commands simultaneously on a line of text, you can use the & command to connect the two commands;
In set/A, it is bitwise AND.
*
\ Represents any character, which is commonly referred to as "wildcard". For example, if you want to find all the character files (.txt) in the C directory, you can enter the command "dir c: \ *. txt ";
In set/A, it is multiplication. For example, set/A x = 4*2. The result is 8;
In findstr/R, match the previous character multiple times.
()
The \ command contains or has a priority identifier. For example, if the for Command needs to use this (), we can also see it in commands such as if and ECHO;
-
\ Range identifier, such as date search, which can be used in the tokens operation in the for command;
Concatenate two characters in findstr/R to indicate the matching range;
-The switch that follows the/of some commands indicates the reverse switch.
+
\ Is mainly used in the Copy command, indicating that this + character is required to merge many files into one file;
In set/A is addition.
|
\ Pipeline operator. The output of the previous command is used as the input of the next command. "DIR/a/B | more", the output information of the Dir command can be displayed on screen;
In set/A, it is bitwise OR;
In the help document, two switches, options, or parameters are selected.
:
\ Tag locator, which can receive the tag pointed to by the Goto command. For example, a ": Begin" tag is defined in the batch processing file. You can use the "Goto begin" command to go to ": Begin" to execute the batch processing command after the change.
""
\ Specifier. "" is often used to enclose paths with spaces. "" symbols are also required in some commands;
In For/F, the content contained in the content is analyzed as a string;
In For/F "usebackq", the content they contain is treated as the file path and the content of the file is analyzed;
In other cases, the content is a complete string, where >>>, <, &, |, and spaces are not escaped.
/
\ Indicates that the subsequent character (string) Is the function switch (option) of the command ). For example, "DIR/S/B/a-d" indicates different parameters specified by the "dir" command;
Indicates division in set/.
>
\ Command redirection, and redirect the output result of the preceding command to the device behind it, and the content of the device following it is overwritten. For example, you can use "dir> lxmxn.txt" to output the result of the "dir" command to the "lxmxn.txt" text file;
In findstr/R, the right boundary of the matching word must be used with the Escape Character.
>
\ Command redirection character. Redirect the output result of the preceding command to the device after the command. The content of the device after the command is not overwritten.
<
\ Use the content of the file after it as the input of the previous command.
In findstr/R, the left boundary of the matching word must be used in combination with the Escape Character.
=
\ Value assignment symbol, used to assign values to variables. For example, "set a = Windows" means to assign the "Windows" string to the variable "";
Indicates arithmetic operations in set/a, such as "set/A x = 5-6*5 ".
\
In some cases, this "\" symbol represents the root directory of the current path. for example, if the current directory is in c: \ windows \ system32, then "dir \" is equivalent to "dir c :\"
In findstr/R, it indicates the regular escape character.
''
In For/F, the content contained in them is executed as a command line and its output is analyzed;
In For/F "usebackq", the strings they contain are analyzed as strings.
.
\\
When the path \ is followed or appears separately:
One. indicates the current directory;
Two. indicates the upper-level directory;
When the file name appears in the path:
The last. indicates the separation of the main file name and the extension file name.
&&
\ Connect two commands. When the & command is successful, the & command is executed;
|
\ Connect two commands. When | the previous command fails, it is executed | the subsequent command.
$
\ Indicates the end of a row in the findstr command.
''
In For/F, the content they contain is executed as a command line and its output is analyzed.
[]
In the help document, the switch, option, or parameter is optional;
In findstr/R, match by the specified character set.
?
\ In findstr/R, it indicates that an arbitrary character is matched at this position;
? In the path, it indicates that any character is assigned at this position;
The Command help document is obtained immediately after.
!
\ When variable delay is enabled, use !! Extend the variable name to indicate reference to the variable value;
In set/a, it indicates logical non. For example, set/A =! 0, then a indicates logic 1.