You can save this thing first to facilitate future search
Title: [Compilation Reference] Reference for the function of symbols under CMD/DOS
Author: lxmxn[at]
Time: 2007-5-27
Email: lxmxn520[at]
Note: 1. Please indicate the source of the original post belongs to the China DOS Alliance (/forum);
2. Everyone is welcome to add symbols that have not been explained yet;
3. Please point out any errors;
4. Special thanks to qzwqzw for the supplements and suggestions made on this information.
Start of the text:
__________________________________________________________________________________________
1. Single symbol
~
① In for, use enhanced variable extensions.
② In %var:~n,m% represents a string that specifies the location using the extended environment variable.
③ Denote a unary operator in set/a, and the operand is inversely bitwise.
!
① The unary operator in set /a indicates logical non-representation. For example, set /a a=!0, then a represents logic 1.
@
① Hidden echoes of the command line itself, which are often used in batch processing.
$
① In the findstr command, indicate the end of a line.
② In the propt command, it means escape (symbolized or effected) of the following characters.
%
① The binary operator in set /a represents the arithmetic remnant.
② In the command line environment, before the for command in, a character (can be a letter, a number or some specific characters) is followed to indicate a loop or traverse the indicator variable.
③ In batch processing, a number is followed by a reference to the specified parameters at the moment of execution of this batch.
④ In other cases, % will be removed (batch) or retained (command line)
^
① Cancel the escape function of specific characters, such as & | > < ! " etc., but does not include %. For example, when you want to display some special characters on the screen, such as > >> | ^ &, etc., you can add a ^ symbol before it to display the characters after this ^. ^^ is to display a ^, and ^| is to display a | character;
② The binary operator in set/a represents bitwise xOR.
③ In the [] of findstr/r, it means that the specified character set does not match.
&
① Command to connect characters. For example, if I want to execute two commands at the same time on a line of text, I can use the & command to connect these two commands.
② In set/a, it is bitwise and.
*
① Represent any arbitrary character, which is what we usually call "wildcards". For example, if you want to find all text files (.txt) in the root directory of the c drive, you can enter the command "dir c:\*.txt".
② The binary operator in set /a represents arithmetic multiplication.
③ In findstr/r, it means that the previous character is matched multiple times.
-
① Range denotation, such as date search, this character can be used in the tokens operation in the for command.
② Concatenate two characters in findstr/r to represent the matching range.
③ -A switch that follows / after some commands indicates that it takes the reverse direction.
④ In set /a:
1. Represents a negative number.
2. Represents arithmetic subtraction operation.
+
① Mainly it will be used in the copy command, which means that if many files are merged into one file, this + character needs to be used.
② The binary operator in set/a represents arithmetic addition.
:
① Tag locator, which means that the following string is a tag, can be used as the object of the goto command. For example, a ":begin" tag is defined in a batch file, and you can use the "goto begin" command to go to the ":begin" tag to execute the batch command.
② Separate the variable name and replaced string relationship in %var:string1=string2%.
|
① The pipe character is to use the output of the previous command as the input of the next command. "dir /a/b |more" can display the information output by the dir command screen by screen.
② The binary operator in set/a represents bitwise or.
③ In the help document, it means that the two switches, options or parameters are selected from one of two before and after.
/
① Indicates that the character (string) after it is the function switch (option) of the command. For example, "dir /s/b/a-d" means different parameters specified by the "dir" command.
② Denote division in set/a.
>
① Command redirection character, redirects the output result of the previous command to the device behind it, and the content in the device behind it is overwritten. For example, you can use "dir >" to output the result of the "dir" command to the text file "".
② In findstr/r, it indicates the right boundary of the matching word, and needs to be used with escape characters\.
<
① Use the content of the file that follows it as input to its previous command.
② In findstr/r, it indicates the left boundary of the matching word, and needs to be used with escape characters\.
=
① Assignment symbol, used for assignment of variables. For example, "set a=windows" means assigning the string "windows" to the variable "a".
② Represent 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 under c:\windows\system32, then if you "dir \", it is equivalent to "dir c:\".
② Represents regular escape characters in findstr/r.
,
① The splitter representing a continuous expression in set /a.
②Segment elements in certain commands.
.
① When the path is followed or appears separately:
A. represents the current directory.
Two. Represents the previous level directory.
② When it appears in the file name in the path:
The last one represents the separation of the main file name and the extended file name.
?
① In findstr/r, it means that arbitrary character is matched at this position.
② In the path, it means that any character is wildly assigned at this location.
③ Follow / to indicate the help document for obtaining the command.
__________________________________________________________________________________________
2. Multiple symbols (symbols cannot be separated)
&&
① Connect two commands, and only execute the command after && after the command is successful.
||
① Connect two commands, and execute the command after || when the command before || fails.
>&
① Write the output of one handle to the input of another handle.
<&
① Read input from one handle and write it to the output of another handle.
%%
① Two consecutive % means that they are removed into one % in pretreatment.
② In batch processing, before the in clause of the for statement, two consecutive % are followed by a character (can be letters, numbers and some specific characters), indicating that a cycle is specified.
Ring or traversing indicator variables.
③ In batch processing, in the for statement, the same string as the indicator variable specified before in is used to refer to this indicator variable.
>>
① Command redirector, append the output result of the command before it to the device behind it.
② The binary operator in set /a indicates the logic shift right.
==
① In the if command, determine whether the elements on both sides are the same.
<<
① The binary operator in set /a indicates the logic shift left.
+=
① Binary operator in set /a. For example, set /a a+=b means assigning the result of a plus b to a.
-=
① Binary operator in set /a. For example, set /a a-=b means assigning the result of subtracting a to a.
*=
① Binary operator in set /a. For example, set /a a*=b means assigning the result of multiplying a by b to a.
/=
① Binary operator in set /a. For example, set /a a/=b means assigning the result of a plus b to a.
%=
① Binary operator in set /a. For example, set /a a%=b means assigning the remainder of a divided by b to a.
[Note: You can use set /a a%=b directly on the command line, and you can use set /a a%%%=b in batch processing. 】
^=
① Binary operator in set /a. For example, set /a a"^="b means assigning the result of bitwise difference between a and b to a.
[Note: Here "^=" is added to quotes to prevent ^ from being escaped, the same below. 】
&=
① Binary operator in set /a. For example, set /a a"&="b means assigning the result of bitwise a and b to a.
|=
① Binary operator in set /a. For example, set /a a"|="b means assigning the result of bitwise or of a and b to a.
<<=
① Binary operator in set /a. For example, set /a a"<<="b means assigning the result of bit shifting a bit left to a.
>>=
① Binary operator in set /a. For example, set /a a">>="b means assigning the result of shifting a bit right to b bit to a.
\<
① In the general expression of findstr, the beginning of the word is represented.
\>
① In the general expression of findstr, the end of the word is represented.
__________________________________________________________________________________________
3. Double symbol pair (a string must be specified between two symbols)
! !
① When variable delay is enabled, use!! to expand the variable name to represent a reference to the variable value.
' '
① In for/f, it means that the content they contain is executed as a command line and analyzes its output.
② In for/f "usebackq" means that the strings they contain are analyzed as strings.
( )
① The command contains or has priority delimiter. For example, if the for command needs to use this (), we can also see it in commands such as if, echo, etc.
② In set /a, represent expression grouping.
" "
① Delimiter. When defining paths with spaces, "" is often used to enclose the paths, and the " " symbol is also required in some commands.
② In for/f, the contents they contain are analyzed as strings.
③ In for/f “usebackq”, it means that the content they contain is taken as the file path and the content of their file is analyzed.
④ In other cases, it means that the content is a complete string, and the >, >>, <, &, |, spaces, etc. are no longer escaped.
` `
① In for/f, indicate that the content they contain is executed as a command line and analyzes its output.
% %
① Use two separate % to contain a string to represent the environment variable named after this string. For example, a %time% can be extended to the current system time.
[ ]
① In the help document, the switch, option or parameter is optional.
② In findstr /r, it means matching according to the character set specified there.
This article comes from the Extraordinary Batch Exchange Forum. For more exciting articles, please visit.
Title: [Compilation Reference] Reference for the function of symbols under CMD/DOS
Author: lxmxn[at]
Time: 2007-5-27
Email: lxmxn520[at]
Note: 1. Please indicate the source of the original post belongs to the China DOS Alliance (/forum);
2. Everyone is welcome to add symbols that have not been explained yet;
3. Please point out any errors;
4. Special thanks to qzwqzw for the supplements and suggestions made on this information.
Start of the text:
__________________________________________________________________________________________
1. Single symbol
~
① In for, use enhanced variable extensions.
② In %var:~n,m% represents a string that specifies the location using the extended environment variable.
③ Denote a unary operator in set/a, and the operand is inversely bitwise.
!
① The unary operator in set /a indicates logical non-representation. For example, set /a a=!0, then a represents logic 1.
@
① Hidden echoes of the command line itself, which are often used in batch processing.
$
① In the findstr command, indicate the end of a line.
② In the propt command, it means escape (symbolized or effected) of the following characters.
%
① The binary operator in set /a represents the arithmetic remnant.
② In the command line environment, before the for command in, a character (can be a letter, a number or some specific characters) is followed to indicate a loop or traverse the indicator variable.
③ In batch processing, a number is followed by a reference to the specified parameters at the moment of execution of this batch.
④ In other cases, % will be removed (batch) or retained (command line)
^
① Cancel the escape function of specific characters, such as & | > < ! " etc., but does not include %. For example, when you want to display some special characters on the screen, such as > >> | ^ &, etc., you can add a ^ symbol before it to display the characters after this ^. ^^ is to display a ^, and ^| is to display a | character;
② The binary operator in set/a represents bitwise xOR.
③ In the [] of findstr/r, it means that the specified character set does not match.
&
① Command to connect characters. For example, if I want to execute two commands at the same time on a line of text, I can use the & command to connect these two commands.
② In set/a, it is bitwise and.
*
① Represent any arbitrary character, which is what we usually call "wildcards". For example, if you want to find all text files (.txt) in the root directory of the c drive, you can enter the command "dir c:\*.txt".
② The binary operator in set /a represents arithmetic multiplication.
③ In findstr/r, it means that the previous character is matched multiple times.
-
① Range denotation, such as date search, this character can be used in the tokens operation in the for command.
② Concatenate two characters in findstr/r to represent the matching range.
③ -A switch that follows / after some commands indicates that it takes the reverse direction.
④ In set /a:
1. Represents a negative number.
2. Represents arithmetic subtraction operation.
+
① Mainly it will be used in the copy command, which means that if many files are merged into one file, this + character needs to be used.
② The binary operator in set/a represents arithmetic addition.
:
① Tag locator, which means that the following string is a tag, can be used as the object of the goto command. For example, a ":begin" tag is defined in a batch file, and you can use the "goto begin" command to go to the ":begin" tag to execute the batch command.
② Separate the variable name and replaced string relationship in %var:string1=string2%.
|
① The pipe character is to use the output of the previous command as the input of the next command. "dir /a/b |more" can display the information output by the dir command screen by screen.
② The binary operator in set/a represents bitwise or.
③ In the help document, it means that the two switches, options or parameters are selected from one of two before and after.
/
① Indicates that the character (string) after it is the function switch (option) of the command. For example, "dir /s/b/a-d" means different parameters specified by the "dir" command.
② Denote division in set/a.
>
① Command redirection character, redirects the output result of the previous command to the device behind it, and the content in the device behind it is overwritten. For example, you can use "dir >" to output the result of the "dir" command to the text file "".
② In findstr/r, it indicates the right boundary of the matching word, and needs to be used with escape characters\.
<
① Use the content of the file that follows it as input to its previous command.
② In findstr/r, it indicates the left boundary of the matching word, and needs to be used with escape characters\.
=
① Assignment symbol, used for assignment of variables. For example, "set a=windows" means assigning the string "windows" to the variable "a".
② Represent 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 under c:\windows\system32, then if you "dir \", it is equivalent to "dir c:\".
② Represents regular escape characters in findstr/r.
,
① The splitter representing a continuous expression in set /a.
②Segment elements in certain commands.
.
① When the path is followed or appears separately:
A. represents the current directory.
Two. Represents the previous level directory.
② When it appears in the file name in the path:
The last one represents the separation of the main file name and the extended file name.
?
① In findstr/r, it means that arbitrary character is matched at this position.
② In the path, it means that any character is wildly assigned at this location.
③ Follow / to indicate the help document for obtaining the command.
__________________________________________________________________________________________
2. Multiple symbols (symbols cannot be separated)
&&
① Connect two commands, and only execute the command after && after the command is successful.
||
① Connect two commands, and execute the command after || when the command before || fails.
>&
① Write the output of one handle to the input of another handle.
<&
① Read input from one handle and write it to the output of another handle.
%%
① Two consecutive % means that they are removed into one % in pretreatment.
② In batch processing, before the in clause of the for statement, two consecutive % are followed by a character (can be letters, numbers and some specific characters), indicating that a cycle is specified.
Ring or traversing indicator variables.
③ In batch processing, in the for statement, the same string as the indicator variable specified before in is used to refer to this indicator variable.
>>
① Command redirector, append the output result of the command before it to the device behind it.
② The binary operator in set /a indicates the logic shift right.
==
① In the if command, determine whether the elements on both sides are the same.
<<
① The binary operator in set /a indicates the logic shift left.
+=
① Binary operator in set /a. For example, set /a a+=b means assigning the result of a plus b to a.
-=
① Binary operator in set /a. For example, set /a a-=b means assigning the result of subtracting a to a.
*=
① Binary operator in set /a. For example, set /a a*=b means assigning the result of multiplying a by b to a.
/=
① Binary operator in set /a. For example, set /a a/=b means assigning the result of a plus b to a.
%=
① Binary operator in set /a. For example, set /a a%=b means assigning the remainder of a divided by b to a.
[Note: You can use set /a a%=b directly on the command line, and you can use set /a a%%%=b in batch processing. 】
^=
① Binary operator in set /a. For example, set /a a"^="b means assigning the result of bitwise difference between a and b to a.
[Note: Here "^=" is added to quotes to prevent ^ from being escaped, the same below. 】
&=
① Binary operator in set /a. For example, set /a a"&="b means assigning the result of bitwise a and b to a.
|=
① Binary operator in set /a. For example, set /a a"|="b means assigning the result of bitwise or of a and b to a.
<<=
① Binary operator in set /a. For example, set /a a"<<="b means assigning the result of bit shifting a bit left to a.
>>=
① Binary operator in set /a. For example, set /a a">>="b means assigning the result of shifting a bit right to b bit to a.
\<
① In the general expression of findstr, the beginning of the word is represented.
\>
① In the general expression of findstr, the end of the word is represented.
__________________________________________________________________________________________
3. Double symbol pair (a string must be specified between two symbols)
! !
① When variable delay is enabled, use!! to expand the variable name to represent a reference to the variable value.
' '
① In for/f, it means that the content they contain is executed as a command line and analyzes its output.
② In for/f "usebackq" means that the strings they contain are analyzed as strings.
( )
① The command contains or has priority delimiter. For example, if the for command needs to use this (), we can also see it in commands such as if, echo, etc.
② In set /a, represent expression grouping.
" "
① Delimiter. When defining paths with spaces, "" is often used to enclose the paths, and the " " symbol is also required in some commands.
② In for/f, the contents they contain are analyzed as strings.
③ In for/f “usebackq”, it means that the content they contain is taken as the file path and the content of their file is analyzed.
④ In other cases, it means that the content is a complete string, and the >, >>, <, &, |, spaces, etc. are no longer escaped.
` `
① In for/f, indicate that the content they contain is executed as a command line and analyzes its output.
% %
① Use two separate % to contain a string to represent the environment variable named after this string. For example, a %time% can be extended to the current system time.
[ ]
① In the help document, the switch, option or parameter is optional.
② In findstr /r, it means matching according to the character set specified there.
This article comes from the Extraordinary Batch Exchange Forum. For more exciting articles, please visit.