Because there are few summaries of DOS symbols, so according to , after several arrangements, the following "CMD/DOS Symbol Reference" is written. It is recommended that beginners take a good look and veterans review.
Title: Role Reference of Symbols under CMD/DOS
Author: lxmxn bbs.cn-dos.net
Time: 2007-5-27
Email: lxmxn520163.com
Instructions: 1. Please indicate the original post source belonging to the China DOS Union (www.cn-dos.net/forum) when reposting;
2. Everyone is welcome to supplement the symbols not explained yet;
3. Please feel free to point out any errors;
4. Special thanks to qzwqzw for the supplements and suggestions to this material.
Start of the main text:
__________________________________________________________________________________________
I. Single Symbols
~
① In for, it means using enhanced variable expansion.
② In %var:~n,m%, it means using the string at the specified position of the expanded environment variable.
③ In set/a, it means the unary operator, bitwise negation of the operand.
!
① In set /a, the unary operator means logical NOT. For example, set /a a=!0, then a represents logical 1.
@
① Hides the echo of the command line itself, often used in batch processing.
$
① In the findstr command, it means the end of a line.
② In the prompt command, it means escaping the characters after it (symbolizing or effectuating).
%
① In set /a, the binary operator means arithmetic remainder.
② In the command line environment, before in in the for command, a character (can be a letter, number or some specific characters) is followed, indicating specifying a loop or traversal index variable.
③ In batch processing, a number is followed to represent referring to the specified parameter when the current batch processing is executed.
④ In other cases, % will be stripped (batch processing) or retained (command line)
^
① Cancels the escape function of a specific character, such as & | > < ! " etc., but not including %. For example, to display some special characters on the screen, such as > >> | ^ & and other symbols, you can add a ^ symbol in front of them to display the character after this ^; ^^ is to display a ^, ^| is to display a | character;
② In set/a, the binary operator means bitwise XOR.
③ In of findstr/r, it means not matching the specified character set.
&
① Command connection character. For example, if I want to execute two commands on one line of text, I can use the & command to connect these two commands.
② In set/a, it is bitwise AND.
*
① Represents any number of any characters, which is the so-called "wildcard"; 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".
② In set /a, the binary operator means arithmetic multiplication.
③ In findstr/r, it means matching the previous character multiple times.
-
① Range identifier, for example, in date lookup, it can be used in the tokens operation in the for command.
② In findstr/r, connect two characters to represent matching range.
③ - followed after / of some commands means taking the reverse switch.
④ In set /a:
1. Represents a negative number.
2. Represents arithmetic subtraction operation.
+
① Mainly used in the copy command, it means combining many files into one file, and this + character is needed.
② In set/a, the binary operator means arithmetic addition.
:
① Label locator, indicates that the following string is a label, which can be the object of the goto command. For example, a ":begin" label is defined in the batch file, and the "goto begin" command can be used to go to the ":begin" label to execute the batch command.
② In %var:string1=string2%, separates the relationship between the variable name and the replaced string.
|
① Pipe character, which takes 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.
② In set/a, the binary operator means bitwise OR.
③ In the help document, it means that the two switches, options or parameters before and after it are optional.
/
① Represents that the following character (string) is the function switch (option) of the command. For example, "dir /s/b/a-d" means different parameters specified by the "dir" command.
② In set/a, it means division.
>
① Command redirection character, redirects the output result of the previous command to the device behind it, and the content in the following device is overwritten. For example, you can use "dir > lxmxn.txt" to output the result of the "dir" command to the text file "lxmxn.txt".
② In findstr/r, it means matching the right boundary of the word, and needs to be used with the escape character \.
<
① Takes the content of the file behind it as the input of the previous command.
② In findstr/r, it means matching the left boundary of the word, and needs to be used with the escape character \.
=
① Assignment symbol, used for variable assignment. For example, "set a=windows" means assigning the string "windows" to the variable "a".
② In set/a, it means arithmetic operation, for example, "set /a x=5-6*5".
\
① This "\" symbol in some cases represents the root directory of the current path. For example, if the current directory is under c:\windows\system32, then "dir \" is equivalent to "dir c:\".
② In findstr/r, it means the regular escape character.
,
① In set /a, it means the separator of consecutive expressions.
② In some commands, it separates elements.
.
① When following \ in the path or appearing alone:
One. represents the current directory.
Two.. represents the upper-level directory.
② When appearing in the file name in the path:
The last. represents the separator between the main file name and the extension file name.
?
① In findstr/r, it means matching any character at this position.
② In the path, it means matching any character at this position.
③ Followed after / means getting the help document of the command.
__________________________________________________________________________________________
II. Multi-symbols (symbols cannot be separated)
&&
① Connect two commands, and the command after && is executed only when the command before && is successful.
||
① Connect two commands, and the command after || is executed only when the command before || fails.
>&
① Writes the output of one handle to the input of another handle.
<&
① Reads input from one handle and writes it to the output of another handle.
%%
① Two consecutive % mean to be stripped to one % during preprocessing.
② In batch processing, before the in clause of the for statement, two consecutive % follow a character (can be a letter, number and some specific characters), indicating specifying a loop or traversal index variable.
③ In batch processing, in the for statement, use the same string as the index variable specified before in, indicating referring to this index variable.
>>
① Command redirection character, appends the output result of the previous command to the device behind it.
② In set /a, the binary operator means logical right shift.
==
① In the if command, judge whether the elements on both sides of == are the same.
<<
① In set /a, the binary operator means logical left shift.
+=
① In set /a, the binary operator. For example, set /a a+=b means assigning the result of a plus b to a.
-=
① In set /a, the binary operator. For example, set /a a-=b means assigning the result of a minus b to a.
*=
① In set /a, the binary operator. For example, set /a a*=b means assigning the result of a multiplied by b to a.
/=
① In set /a, the binary operator. For example, set /a a/=b means assigning the result of a divided by b to a.
%=
① In set /a, the binary operator. For example, set /a a%=b means assigning the remainder of a divided by b to a.
【Note: The command line can directly use set /a a%=b, and in batch processing, you can use set /a a%%=b.】
^=
① In set /a, the binary operator. For example, set /a a"^="b means assigning the result of a bitwise XOR with b to a.
【Note: Here, "^=" is quoted to prevent ^ from being escaped, the same below.】
&=
① In set /a, the binary operator. For example, set /a a"&="b means assigning the result of a bitwise AND with b to a.
|=
① In set /a, the binary operator. For example, set /a a"|="b means assigning the result of a bitwise OR with b to a.
<<=
① In set /a, the binary operator. For example, set /a a"<<="b means assigning the result of a bitwise left shift by b bits to a.
>>=
① In set /a, the binary operator. For example, set /a a">>="b means assigning the result of a bitwise right shift by b bits to a.
\<
① In the general expression of findstr, it means the beginning of a word.
\>
① In the general expression of findstr, it means the end of a word.
__________________________________________________________________________________________
III. Double-symbol pairs (two symbols must specify a string between them)
! !
① When variable delay is enabled, use!! to enclose the variable name to represent the reference to the variable value.
' '
Title: Role Reference of Symbols under CMD/DOS
Author: lxmxn bbs.cn-dos.net
Time: 2007-5-27
Email: lxmxn520163.com
Instructions: 1. Please indicate the original post source belonging to the China DOS Union (www.cn-dos.net/forum) when reposting;
2. Everyone is welcome to supplement the symbols not explained yet;
3. Please feel free to point out any errors;
4. Special thanks to qzwqzw for the supplements and suggestions to this material.
Start of the main text:
__________________________________________________________________________________________
I. Single Symbols
~
① In for, it means using enhanced variable expansion.
② In %var:~n,m%, it means using the string at the specified position of the expanded environment variable.
③ In set/a, it means the unary operator, bitwise negation of the operand.
!
① In set /a, the unary operator means logical NOT. For example, set /a a=!0, then a represents logical 1.
@
① Hides the echo of the command line itself, often used in batch processing.
$
① In the findstr command, it means the end of a line.
② In the prompt command, it means escaping the characters after it (symbolizing or effectuating).
%
① In set /a, the binary operator means arithmetic remainder.
② In the command line environment, before in in the for command, a character (can be a letter, number or some specific characters) is followed, indicating specifying a loop or traversal index variable.
③ In batch processing, a number is followed to represent referring to the specified parameter when the current batch processing is executed.
④ In other cases, % will be stripped (batch processing) or retained (command line)
^
① Cancels the escape function of a specific character, such as & | > < ! " etc., but not including %. For example, to display some special characters on the screen, such as > >> | ^ & and other symbols, you can add a ^ symbol in front of them to display the character after this ^; ^^ is to display a ^, ^| is to display a | character;
② In set/a, the binary operator means bitwise XOR.
③ In of findstr/r, it means not matching the specified character set.
&
① Command connection character. For example, if I want to execute two commands on one line of text, I can use the & command to connect these two commands.
② In set/a, it is bitwise AND.
*
① Represents any number of any characters, which is the so-called "wildcard"; 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".
② In set /a, the binary operator means arithmetic multiplication.
③ In findstr/r, it means matching the previous character multiple times.
-
① Range identifier, for example, in date lookup, it can be used in the tokens operation in the for command.
② In findstr/r, connect two characters to represent matching range.
③ - followed after / of some commands means taking the reverse switch.
④ In set /a:
1. Represents a negative number.
2. Represents arithmetic subtraction operation.
+
① Mainly used in the copy command, it means combining many files into one file, and this + character is needed.
② In set/a, the binary operator means arithmetic addition.
:
① Label locator, indicates that the following string is a label, which can be the object of the goto command. For example, a ":begin" label is defined in the batch file, and the "goto begin" command can be used to go to the ":begin" label to execute the batch command.
② In %var:string1=string2%, separates the relationship between the variable name and the replaced string.
|
① Pipe character, which takes 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.
② In set/a, the binary operator means bitwise OR.
③ In the help document, it means that the two switches, options or parameters before and after it are optional.
/
① Represents that the following character (string) is the function switch (option) of the command. For example, "dir /s/b/a-d" means different parameters specified by the "dir" command.
② In set/a, it means division.
>
① Command redirection character, redirects the output result of the previous command to the device behind it, and the content in the following device is overwritten. For example, you can use "dir > lxmxn.txt" to output the result of the "dir" command to the text file "lxmxn.txt".
② In findstr/r, it means matching the right boundary of the word, and needs to be used with the escape character \.
<
① Takes the content of the file behind it as the input of the previous command.
② In findstr/r, it means matching the left boundary of the word, and needs to be used with the escape character \.
=
① Assignment symbol, used for variable assignment. For example, "set a=windows" means assigning the string "windows" to the variable "a".
② In set/a, it means arithmetic operation, for example, "set /a x=5-6*5".
\
① This "\" symbol in some cases represents the root directory of the current path. For example, if the current directory is under c:\windows\system32, then "dir \" is equivalent to "dir c:\".
② In findstr/r, it means the regular escape character.
,
① In set /a, it means the separator of consecutive expressions.
② In some commands, it separates elements.
.
① When following \ in the path or appearing alone:
One. represents the current directory.
Two.. represents the upper-level directory.
② When appearing in the file name in the path:
The last. represents the separator between the main file name and the extension file name.
?
① In findstr/r, it means matching any character at this position.
② In the path, it means matching any character at this position.
③ Followed after / means getting the help document of the command.
__________________________________________________________________________________________
II. Multi-symbols (symbols cannot be separated)
&&
① Connect two commands, and the command after && is executed only when the command before && is successful.
||
① Connect two commands, and the command after || is executed only when the command before || fails.
>&
① Writes the output of one handle to the input of another handle.
<&
① Reads input from one handle and writes it to the output of another handle.
%%
① Two consecutive % mean to be stripped to one % during preprocessing.
② In batch processing, before the in clause of the for statement, two consecutive % follow a character (can be a letter, number and some specific characters), indicating specifying a loop or traversal index variable.
③ In batch processing, in the for statement, use the same string as the index variable specified before in, indicating referring to this index variable.
>>
① Command redirection character, appends the output result of the previous command to the device behind it.
② In set /a, the binary operator means logical right shift.
==
① In the if command, judge whether the elements on both sides of == are the same.
<<
① In set /a, the binary operator means logical left shift.
+=
① In set /a, the binary operator. For example, set /a a+=b means assigning the result of a plus b to a.
-=
① In set /a, the binary operator. For example, set /a a-=b means assigning the result of a minus b to a.
*=
① In set /a, the binary operator. For example, set /a a*=b means assigning the result of a multiplied by b to a.
/=
① In set /a, the binary operator. For example, set /a a/=b means assigning the result of a divided by b to a.
%=
① In set /a, the binary operator. For example, set /a a%=b means assigning the remainder of a divided by b to a.
【Note: The command line can directly use set /a a%=b, and in batch processing, you can use set /a a%%=b.】
^=
① In set /a, the binary operator. For example, set /a a"^="b means assigning the result of a bitwise XOR with b to a.
【Note: Here, "^=" is quoted to prevent ^ from being escaped, the same below.】
&=
① In set /a, the binary operator. For example, set /a a"&="b means assigning the result of a bitwise AND with b to a.
|=
① In set /a, the binary operator. For example, set /a a"|="b means assigning the result of a bitwise OR with b to a.
<<=
① In set /a, the binary operator. For example, set /a a"<<="b means assigning the result of a bitwise left shift by b bits to a.
>>=
① In set /a, the binary operator. For example, set /a a">>="b means assigning the result of a bitwise right shift by b bits to a.
\<
① In the general expression of findstr, it means the beginning of a word.
\>
① In the general expression of findstr, it means the end of a word.
__________________________________________________________________________________________
III. Double-symbol pairs (two symbols must specify a string between them)
! !
① When variable delay is enabled, use!! to enclose the variable name to represent the reference to the variable value.
' '
Recent Ratings for This Post
( 27 in total)
Click for details
| Rater | Score | Time |
|---|---|---|
| bjsh | +20 | 2007-05-27 19:55 |
| qzwqzw | +15 | 2007-05-27 19:57 |
| zh159 | +15 | 2007-05-27 20:24 |
| qinbuer | +2 | 2007-06-01 02:04 |
| qingfushuan | +2 | 2007-06-01 13:31 |
| vlq5299 | +2 | 2007-06-09 00:52 |
| Billunique | +4 | 2007-09-20 23:08 |
| everest79 | +15 | 2007-10-07 21:49 |
| chhm2123 | +1 | 2007-10-23 11:15 |
| zouzhxi | +4 | 2007-10-31 17:17 |
| zqdarkday | +2 | 2007-11-15 01:34 |
| honghunter | +2 | 2007-12-04 16:41 |
| regvip2008 | +2 | 2007-12-09 11:14 |
| xiaohacker | +2 | 2007-12-23 20:29 |
| kootoo | +2 | 2007-12-25 19:07 |
| haiou327 | +4 | 2008-01-03 19:08 |
| 523066680 | +8 | 2008-08-15 20:09 |
| applecy | +2 | 2008-10-04 10:39 |
| taotaomike | +1 | 2008-10-10 12:00 |
| exzzz | +2 | 2009-01-12 14:29 |
| slx8528 | +1 | 2009-02-07 15:34 |
| joyoustar | +2 | 2009-04-08 03:46 |
| shifengl | +1 | 2009-05-21 08:39 |
| zhangwencheng | +2 | 2009-05-29 07:31 |
| kevinm | +1 | 2009-12-03 22:27 |
| hxuan999 | +4 | 2009-12-23 22:19 |
| zzz19760225 | +2 | 2017-10-29 10:32 |

StickyI