Often need to know the role of Cmd/dos under the reference, just found this article _dos/bat

Source: Internet
Author: User
Tags arithmetic bitwise goto
We can first put this thing, the collection, convenient to find later
Title: [Collation Reference] The role of the symbol under Cmd/dos reference
Author: lxmxn [at] bbs.cn-dos.net
Time: 2007-5-27
Email: lxmxn520[at]163.com
NOTE: 1, reprint Please indicate the origin of the original posts belong to China's DOS Alliance (www.cn-dos.net/forum);
2, welcome everyone to add to the symbols that have not been explained;
3, have any mistake also please hesitate to point out;
4. Special thanks to QZWQZW for the additional and recommendations made in this information.

Body Start:
__________________________________________________________________________________________
One, single symbol
~
① in a for means the use of enhanced variable extensions.
② in%var:~n,m% represents a string that uses the specified location of the extended environment variable.
③ represents a unary operator in set/a, and the operand is reversed by a bitwise.

!
① is a unary operator in set/a that represents a logical non. For example, set/a a=!0, when a represents logic 1.

@
① hides the echo of the command line itself, which is often used in batch processing.

$
① represents the end of a line in the findstr command.
② in the prompt command, which means that the following words will be escape (symbolic or effective).

%
① is a two-dollar operator in set/a that represents an arithmetic fetch.
In the ② command-line environment, a character (which can be a letter, a number, or some specific character) is followed by the for command in, indicating that a loop is specified or the index variable is traversed.
③ batch, followed by a number that refers to the specified parameters that refer to the current execution of this batch.
④ in other cases,% will be removed (batch processing) or reserved (command line)

^
① remove the escaping function of a particular character, such as & | > <! "And so on, but does not include%. For example, to display some special characters on the screen, such as > >> | ^ & And so on, you can add a ^ symbol in front of it to show the character after this ^, ^^ is to show a ^,^| is to display a | character;
A two-② operator in set/a that represents a bitwise XOR.
③ indicates that the specified character set is not matched in findstr/r [].

&
① the command connection character. For example, if I want to execute two commands simultaneously on one line of text, I can connect the two commands with the & command.
② in the set/a is bitwise-and.

*
① represents any arbitrary character, which is what we usually call "wildcard characters"; For example, to find all the text files (. txt) in the root directory of the C disk, you can enter the command "dir c:\*.txt".
② the two-dollar operator in set/a, representing arithmetic multiplication.
③ in FINDSTR/R indicates that the previous character is matched multiple times.

-
① range notation, such as date lookup, can be used in the tokens operation in the for command.
② joins two characters in findstr/r to represent the matching range.
The ③-is followed by some command/post to indicate the reverse switch.
④ in set/a:
1. Represents a negative number.
2. Represents an arithmetic subtraction operation.

+
① mainly in the copy command will use it, means that many files merged into a file, it is necessary to use this + character.
② is a two-dollar operator in set/a that represents arithmetic addition.

:
The ① tag locator, which indicates that the following string is labeled as the object of the goto command. For example, a ": Begin" label is defined in a batch file, and the Goto BEGIN command allows you to go to the ": Begin" tab to execute a batch command.
② separates variable names and replaced string relationships in%var:string1=string2%.

|
The ① pipe character is the output of the last command as input to the next command. dir/a/b |more "Displays the information that the dir command prints on a per-screen basis.
A two-② operator in set/a that represents a bitwise OR.
③ indicates that the two switches, options, or parameters in the Help document are two selected.

/
① indicates that the character (string) that follows is the function switch (option) for the command. For example, "dir/s/b/a-d" indicates the different parameters specified by the "dir" command.
② represents division in the set/a.

>
① the command redirection character to redirect the output of the previous command to the device behind it, and the contents of the subsequent device are overwritten. For example, you can use "dir > lxmxn.txt" to output the results of the "dir" command to the "lxmxn.txt" text file.
② represents the right boundary of a matching word in findstr/r and needs to be used with the escape character \.

<
① the contents of the file behind it as input to its previous command.
② represents the left edge of the matching word in findstr/r and needs to be used with the escape character \.

=
① assignment symbol, for assignment of variables. For example, "set a=windows" means to assign the "Windows" string to the variable "a".
② represents arithmetic operations in set/a, such as "set/a x=5-6*5".

\
① this "\" symbol, in some cases, represents the root directory of the current path. For example, the current directory under C:\Windows\System32, then you "Dir", is quite the "dir c:\".
② represents the regular escape character in findstr/r.

,
① a delimiter in set/a that represents a continuous expression.
② splits elements in some commands.

.
① immediately after the path's \ After or when it appears alone:
One. Represents the current directory.
Two. Represents a previous level of directory.
② appears in the file name in the path:
The last one. Represents the separation of the primary file name from the extended file name.

?
① in findstr/r to match an arbitrary character in this position.
② in the path indicates that any one character is being matched at this location.
③ the help document to get the command immediately after/after.

__________________________________________________________________________________________

Two, multiple symbols (symbols can not be separated)

&&
The ① connects two commands and executes the && command when the && command succeeds.

||
① connection two commands, when | | Before the command fails to execute After the command.

>&
① writes the output of one handle to the input of another handle.

<&
① reads the input from a handle and writes it to another handle output.

%%
① two consecutive% representations are removed as a% in preprocessing.
In a ② batch, two consecutive% followed by a character (can be letters, numbers, and some specific characters) immediately before the in clause of a For statement, indicating that a follow

Loop or traverse the indicator variable.
In the ③ batch, in the For statement, use the same string as the metric variable specified before, to indicate that the metric variable is referenced.

>>
① the command redirection character to append the output of the previous command to the device behind it.
② the two-dollar operator in set/a that represents the logical right shift.

==
① in the IF command to determine whether the elements are the same on either side of = =.

<<
① the two-dollar operator in set/a that represents the logical left shift.

+=
The two-① operator in the set/a. For example, set/a a+=b indicates that the result of a plus B is assigned to a.

-=
The two-① operator in the set/a. For example, set/a a-=b indicates that the result of a minus B is assigned to a.

*=
The two-① operator in the set/a. For example, set/a a*=b indicates that the result of a Times B is assigned to a.

/=
The two-① operator in the set/a. For example, set/a a/=b indicates that the result of a plus B is assigned to a.

%=
The two-① operator in the set/a. For example, set/a a%=b represents assigning a to a by dividing the remainder of a B.
"Note: The command line can be used directly with set/a a%=b, in batch processing can be used set/a a%%=b." 】

^=
The two-① operator in the set/a. For example, set/a a "^=" B means assigning A and B-per-bitwise results to a.
"Note: Here the" ^= "is quoted in order to prevent ^ from being escaped, the same below. 】

&=
The two-① operator in the set/a. For example, set/a a "&=" b indicates that A and B bitwise and results are assigned to a.

|=
The two-① operator in the set/a. For example, set/a a "|=" b indicates that A and B bitwise-or results are assigned to a.

<<=
The two-① operator in the set/a. For example, set/a a "<<=" b indicates that the result of a bitwise shift to the left B bit is assigned to a.

>>=
The two-① operator in the set/a. For example, set/a a ">>=" b indicates that the result of a bitwise right SHIFT to B is assigned to a.

\<
① represents the beginning of a word in a general expression of findstr.

\>
① represents the end of a word in a general expression of findstr.

__________________________________________________________________________________________

Three, double sign pair (must specify a string between two symbols)

! !
① when variable delay is enabled, use!! Expands the variable name to represent a reference to the value of the variable.

' '
① in for/f indicates that the content they contain is executed as a command line and its output is parsed.
② in for/f "Usebackq" indicates that the strings they contain are parsed as strings.

( )
The ① command contains or has a precedence qualifier, such as the for command to use this (), and we can also see it in If,echo and other commands.
② represents an expression grouping in set/a.

" "
The ① qualifier, which is used to enclose the path in a path that indicates a space, often requires a "" symbol in some commands.
② will represent what they contain as string parsing in for/f.
③ in for/f "usebackq" means that they contain content as a file path and analyze the contents of its files.
④ in other cases, the contents of which is a complete string, where the >, >>, <, &, |, space, etc. are no longer escaped.

` `
① in for/f that they contain content that executes as a command line and analyzes its output.

% %
① uses two separate% to contain a string that refers to an environment variable named after this string. For example, a%time% can be extended to the current system time.

[ ]
① a switch, option, or parameter in the Help document that is optional.
② in findstr/r to match the character set that is specified.
This article is from the very batch Exchange forum, more wonderful articles please visit bbs.verybat.cn.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.