Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of symbols under CMD/DOS

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the use of symbols under CMD/DOS, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

_

I. single symbol

~

① means to use enhanced variable extensions in for.

② represents a string that specifies a location using an extended environment variable in% var:~n,m%.

③ represents a unary operator in set/an and inverts the operands bitwise.

!

① unary operators in set / a denote logically non. For example, set / a has zero, where a stands for logic 1.

@

① hides the echo of the command line itself and is often used in batches.

$

① indicates the end of a line in the findstr command.

In the prompt command, ② means to escape (symbolize or effect) subsequent characters.

%

The binary operator of ① in set / a, indicating the arithmetic remainder.

In the ② command line environment, the for command in is preceded by a character (which can be a letter, a number, or some specific character) to indicate that a loop or traversal metric variable is specified.

In a ③ batch, a number followed by a number refers to the specified parameter at the time of the current execution of the batch.

In other cases of ④,% will be removed (batch) or retained (command line)

^

① cancels the escape of specific characters, such as & | >

< ! "等,但不包括%。比如要在屏幕显示一些特殊的字符,比如>

> > | when ^ & and other symbols, you can add a ^ symbol before it to display the characters after the ^. ^ ^ is to display a ^, ^ | is to display a | character.

The binary operator of ② in set/a that represents bitwise XOR.

③ indicates in [] of findstr/r that it does not match the specified character set.

&

① command concatenation characters. For example, if I want to execute two commands at the same time on a line of text, I can connect the two commands with the & command.

② in set/an is bitwise and.

*

① stands for any character, which is what we usually call a "wildcard"; for example, if you want to find all the text files (.txt) in the root directory of disk c, you can type the command "dir c:\ * .txt".

The binary operator of ② in set / a, representing arithmetic multiplication.

③ in findstr/r means that the previous character will be matched multiple times.

-

① range representations, such as date lookups, can be used in the tokens operation in the for command.

② concatenates two characters in findstr/r to indicate a matching range.

③-A switch that follows the / of some commands to indicate the reverse.

④ in set / a:

1. Represents a negative number.

two。 Represents arithmetic subtraction.

+

① is mainly used in the copy command, which means that the + character is about to be used when many files are merged into one file.

The binary operator of ② in set/a, representing arithmetic addition.

:

The ① tag locator, which indicates that the following string is labeled and can be used as the object of the goto command. For example, a ": begin" tag is defined in the batch file. With the "goto begin" command, you can go to the ": begin" tag to execute the batch command.

② separates the variable name from the 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 more b | more" can display the output information of the dir command screen by screen.

The binary operator of ② in set/a, representing bitwise or.

③ indicates in the help documentation that its front and back switches, options, or parameters are one of the two.

/

① indicates that the following character (string) is the function switch (option) of the command. For example, "dir / s/b/a-d" represents the different parameters specified by the "dir" command.

② represents division in set/a.

>

The ① command redirects the output of the command before it to the device behind it, and the contents of the device behind it are overwritten. For example, you can use "dir > lxmxn.txt" to output the result 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\.

< ① 将其后面的文件的内容作为其前面命令的输入。 ② 在findstr/r中表示匹配单词的左边界,需要配合转义字符\使用。 = ① 赋值符号,用于变量的赋值。比如"set a=windows"的意思意思是将"windows"这个字符串赋给变量"a"。 ② 在set/a中表示算术运算,比如"set /a x=5-6*5"。 \ ① 这个"\"符号在有的情况下,代表的是当前路径的根目录.比如当前目录在c:\windows\system32下,那么你"dir \"的话,就相当与"dir c:\"。 ② 在findstr/r中表示正则转义字符。 , ① 在set /a中表示连续表达式的分割符。 ② 在某些命令中分割元素。 . ① 在路径的\后紧跟或者单独出现时: 一个.表示当前目录。 两个.表示上一级目录。 ② 在路径中的文件名中出现时: 最后的一个.表示主文件名与扩展文件名的分隔。 ? ① 在findstr/r中表示在此位置匹配一个任意字符。 ② 在路径中表示在此位置通配任意一个字符。 ③ 紧跟在/后表示获取命令的帮助文档。 __________________________________________________________________________________________             二、多符号(符号不能分隔) && ① 连接两个命令,当&&前的命令成功时,才执行&&后的命令。 || ① 连接两个命令,当||前的命令失败时,才执行||后的命令。 >

&

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

>

The ① command redirector appends the output of the command before it to the device behind it.

The binary operator of ② in set / a, indicating that the logic shifts to the right.

= =

① determines whether the elements on both sides of = = are the same in the if command.

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

_

3. Double symbol pairs (string must be specified between two symbols)

!!

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

''

① in for/f means to execute what they contain as a command line and analyze their output.

② in for/f "usebackq" means to parse the strings they contain as strings.

(.)

① commands contain or have priority delimiters, such as the for command to use this (), we can also see it in commands such as if,echo.

② represents expression grouping in set / a.

"

The ① delimiter, which often uses "" to enclose a path when representing a path with spaces, is also required in some commands.

② parses what represents what they contain as a string in for/f.

③ in for/f "usebackq" indicates that the content they contain is treated as a file path and analyzes the contents of their files.

In other cases, ④ indicates that the content is a complete string, in which >,

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report