China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-26 17:12
中国DOS联盟论坛 » 其它操作系统综合讨论区 » Problems with Windows command symbols View 24,419 Replies 126
Original Poster Posted 2006-10-28 23:46 ·  美国 德克萨斯州 贝尔 基林 Charter_Communications
初级用户
Credits 29
Posts 10
Joined 2006-10-18 15:11
19-year member
UID 66445
Gender Male
Status Offline
In the process of learning DOS, I found that when looking at some examples, many people often use unused symbols, and there are many changes. Sometimes I understand the commands, but I get stuck here on the symbols. Can you guys concentrate and explain these symbols? I hope it can be more comprehensive, or help me find a place to learn.. Thanks..


Modify the title to match the topic content. Original title: DOS Symbol Problem
——Administrator
Floor 2 Posted 2006-10-29 00:00 ·  中国 四川 成都 电信
铂金会员
★★★★
Credits 7,493
Posts 2,672
Joined 2005-09-02 00:00
20-year member
UID 42173
Gender Male
Status Offline
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
fastrun -2 2007-12-09 21:56

C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>"
Floor 3 Posted 2006-10-29 13:02 ·  美国 德克萨斯州 贝尔 基林 Charter_Communications
初级用户
Credits 29
Posts 10
Joined 2006-10-18 15:11
19-year member
UID 66445
Gender Male
Status Offline
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
fastrun +2 2007-12-09 21:56
qinchun36 +1 2008-04-23 20:31
Floor 4 Posted 2006-10-29 13:47 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline


  Re: panhong1986

  The following is a reply to your topic, and it can also be regarded as a summary of the functions of characters in the learning process of batch processing by myself.

  The following summary is limited by my ability and experience, so there are inevitable mistakes or omissions. If there are any problems, you and everyone are welcome to criticize and correct. The following is not comprehensive, and it will be gradually supplemented later.

: The content after \\ is a comment; in addition, thanks to qzwqzw for supplementing this material.
__________________________________________________________________________________________

@
\\Hide the echo of the command.

~
\\In for, it means using enhanced variable expansion;
In set, it means using the string of the specified position of the extended environment variable;
In set/a, it means bitwise negation.

%
\\Using two % to contain a string means to reference an environment variable. For example, a %time% can be expanded to the current system time;
A single % followed by a number from 0-9 means to reference a command line parameter;
Used in for to mean referencing a loop variable;
Two consecutive % mean to be reduced to one % during execution.

^
\\Cancel the escape character, that is, turn off the escape function of all escape characters. For example, to display some special characters on the screen, such as > >> | ^, etc., you can add a ^ symbol in front of it to display the character after this ^, ^^ is to display a ^, ^| is to display a | character;
In set/a, it is bitwise XOR;
In the 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, it is multiplication. For example, "set/a x=4*2", the result is 8;
In findstr/r, it means to match the previous character multiple times.

()
\\Command inclusion or a delimiter with priority. For example, the for command uses this (), and we can also see its presence in commands such as if and echo;

-
\\Range identifier, such as date lookup, can be used in the tokens operation in the for command;
In findstr/r, connect two characters to represent matching range;
- After some commands' / indicates taking the reverse switch.

+
\\Mainly used in the copy command, it means to combine many files into one file, and this + character is used;
In set/a, it is addition.

|
\\Pipe character. It means 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;
In set/a, it is bitwise OR;
In the help document, it means that the two switches, options or parameters before and after it are optional.

:
\\Label locator, which can accept the label pointed to by the goto command. For example, if a ":begin" label is defined in the batch file, the "goto begin" command can be used to go to the ":begin" change and execute the batch command later.

" "
\\Delimiter, when indicating a path with spaces, "" is often used to enclose the path, and "" symbols are also needed in some commands;
In for/f, it means that the content they contain is analyzed as a string;
In for/f "usebackq" means that the content they contain is regarded as a file path and the content of its file is analyzed;
In other cases, it means that the content inside is a complete string, and >, >>, <, &, |, space, etc. are no longer escaped.

/
\\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;
In set/a, it means division.

>
\\Command redirection character, redirect the output result of the previous command to the device behind it, and the content in the subsequent 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, which needs to be used with the escape character \.

>>
\\Command redirection character. Redirect the output result of the previous command to the device behind it, and the content in the subsequent device is not overwritten.

<
\\Use 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, which 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".

\
\\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 "dir \"" is equivalent to "dir c:\"
In findstr/r, it means a regular escape character.

''
In for/f, it means that the content they contain is executed as a command line and analyzed;
In for/f "usebackq", it means that the string they contain is analyzed as a string.

.
\\
When followed immediately after \ in the path or appearing alone:
One. means the current directory;
Two. means the upper level directory;
When appearing in the file name in the path:
The last. means the separator between the main file name and the extension file name.

&&
\\Connect two commands, and the command after && will be executed only if the command before && is successful;

||
\\Connect two commands, and the command after || will be executed only if the command before || fails.

$
\\In the findstr command, it means the end of a line.

``
In for/f, it means that the content they contain is executed as a command line and its output is analyzed.


In the help document, it means that the switches, options or parameters inside are optional;
In findstr/r, it means matching according to the specified character set.

?
\\In findstr/r, it means matching an arbitrary character at this position;
? in the path means matching any one character at this position;
Immediately after / means to get the help document of the command.

!
\\When variable delay is enabled, use!! to enclose the variable name to mean referencing the variable value;
In set /a, it means logical NOT. For example, set /a a=!0, then a means logical 1.
__________________________________________________________________________________________

①: The fourth supplementary material was on 2006.10.30.
②: The fourth supplementary material was on 2006.11.08.
③: The fourth supplementary material was on 2006.01.24.
④: The fourth supplementary material was on 2007.03.13.


[ Last edited by lxmxn on 2007-4-5 at 01:37 PM ]
Recent Ratings for This Post ( 10 in total) Click for details
RaterScoreTime
redtek +10 2006-10-29 20:00
chainliq +6 2007-01-13 04:37
sleet1986 +1 2007-01-13 07:15
zhxy9804 +2 2007-01-19 21:51
beeny +1 2007-01-23 23:22
bob1989 +1 2007-01-25 00:23
electronixtar +23 2007-03-16 10:41
dthao +4 2007-11-04 07:06
lzl0532 +1 2008-01-11 17:15
mwm5 +1 2009-10-17 20:42
Floor 5 Posted 2006-10-29 14:25 ·  美国 德克萨斯州 贝尔 基林 Charter_Communications
初级用户
Credits 29
Posts 10
Joined 2006-10-18 15:11
19-year member
UID 66445
Gender Male
Status Offline
WOW.... THANK U SO MUCH,DUDE
Floor 6 Posted 2006-10-29 14:30 ·  美国 德克萨斯州 贝尔 基林 Charter_Communications
初级用户
Credits 29
Posts 10
Joined 2006-10-18 15:11
19-year member
UID 66445
Gender Male
Status Offline
It's rare to have such a detailed explanation. When you finish writing all of them, I'll copy them down.
Floor 7 Posted 2006-10-29 20:01 ·  中国 北京 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
lxmxn wrote it really detailed! +10 points~ : )
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 8 Posted 2006-11-23 06:40
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
Hard work pays off. Hehe
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 9 Posted 2006-11-26 09:13 ·  中国 安徽 马鞍山 电信
初级用户
Credits 43
Posts 15
Joined 2006-11-20 01:46
19-year member
UID 71094
Gender Female
Status Offline
Well written! Thanks a lot, lxmxn!
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
+1 2006-11-28 03:04
Floor 10 Posted 2006-12-05 21:39 ·  中国 云南 玉溪 电信
初级用户
Credits 28
Posts 12
Joined 2006-10-17 22:24
19-year member
UID 66155
Status Offline
Please trouble the expert upstairs to fill in when free, we are waiting patiently.
Floor 11 Posted 2006-12-06 02:04 ·  中国 安徽 滁州 电信
新手上路
Credits 4
Posts 2
Joined 2006-06-07 16:22
20-year member
UID 56697
Status Offline
Really learned something here. There are really many experts!
Floor 12 Posted 2006-12-08 14:10 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by ynjzlzd at 2006-12-5 21:39:
Trouble the master upstairs to supplement when free, we are waiting patiently.


  Several symbols have been supplemented today, it seems there are no other symbols. =_=
Floor 13 Posted 2006-12-16 05:05 ·  中国 北京 电信
新手上路
Credits 12
Posts 6
Joined 2006-12-09 12:13
19-year member
UID 73044
Gender Male
Status Offline
Thanks
Floor 14 Posted 2006-12-17 04:31 ·  中国 广东 中山 电信
初级用户
Credits 28
Posts 14
Joined 2006-11-24 21:08
19-year member
UID 71601
Gender Male
Status Offline
Can't see clearly?
Floor 15 Posted 2006-12-17 16:08 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by nt101007 at 2006-12-17 04:31:
Can't see clearly? 》


  What is not clear? I was afraid the font was too small to see clearly, so I特意 adjusted the font to a relatively large size. Why is it still not clear?
1 2 3 9 Next ›
Forum Jump: