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-25 09:18
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Introduction to the Pipe Commands of DOS View 5,056 Replies 13
Original Poster Posted 2002-11-05 00:00 ·  中国 广东 佛山 三水区 电信
元老会员
★★★★
Credits 5,170
Posts 1,637
Joined 2002-10-16 00:00
23-year member
UID 8
Gender Male
From 广东佛山
Status Offline
Introduction to DOS Pipe Commands
Written from memory, please point out or supplement any errors or omissions.
The function of DOS pipe commands is to redirect the output of software. Using them, we can easily intercept the output information of DOS software.
For example, if I want to write an article about the COPY command in DOS and need to use its parameter information, I can use the command copy /? >mycopy.txt, which will input the help information of the COPY command into the text file mycopy.txt. I can modify mycopy.txt to become my article.
If I also need to write about the XCOPY command, I can use xcopy /? >>mycopy.txt to get the parameter information of the XCOPY command again. The difference between >> and > is that if the target file mycopy.txt is not empty, >> will append the new content to the original content, while > will overwrite the original content. > and >> are the special symbols of DOS pipe commands.
Since DOS treats devices as files, including the empty target NUL, pipe commands can also be used to do some other work.
For example: type autoexec.bat >prn OR type autoexec.bat >lpt1 can simply test the printer
copy command.com d:\ >nul will copy command to drive D without any information
If your autoexec.bat is written with DELTREE /Y C:\*.* >NULL, the next time you start up, you will lose all the data on drive C in a frenzy of hard disk light flashing, and there will be no prompt information on the screen.
我的网志
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos
Floor 2 Posted 2002-11-10 00:00 ·  中国 浙江 宁波 联通
中级用户
★★
imp
Credits 312
Posts 82
Joined 2002-11-09 00:00
23-year member
UID 204
Gender Male
Status Offline
Seems very dangerous.
Floor 3 Posted 2002-11-10 00:00 ·  中国 江西 吉安 电信
版主
★★★★
Credits 7,296
Posts 1,628
Joined 2002-10-16 12:00
23-year member
UID 10
Gender Male
Status Offline
The four DOS commands deltree, delete, format, and fdisk are relatively dangerous commands. Don't try them easily if you don't understand them. But if you know what you're doing, that's another matter.
Read more books, understand various commands, and then try them carefully... The first two can be tried. The latter two... If you don't understand, really don't try.
If you want to try, use a virtual machine to try. Hehe...
Other DOS commands are not dangerous. Pipeline commands are not dangerous at all.
I think the pipeline command should also include |.
| is also a pipeline command, and its function is to execute several DOS commands in one line. (This is how I understand it.)
You can give it a try...
For example:
You are in the c:\ccdos directory, and there are two files ccdos.exe and ccdos.txt in it.
The result of your dir is:
.
..
ccdos.exe
ccdos.txt
Then we type:
copy ccdos.txt eg.txt|del ccdos.exe
After execution, dir again:
It becomes:
.
..
ccdos.txt
eg.txt
What does it show? This line executed two DOS commands, hehehe...
ko20010214
=================================
大功告成,打个Kiss!
ko20010214@MSN.com
神州优雅Q300C
Intel CeleronM 370处理器 | 256MbDDR内存
40G硬盘 | USB2.0 | IEEE 1394
13.3 ' WXGA 宽屏(16:10) | COMBO光驱
10/100M网卡 | 四合一读卡器
Floor 4 Posted 2002-11-13 00:00 ·  中国 浙江 宁波 联通
中级用户
★★
imp
Credits 312
Posts 82
Joined 2002-11-09 00:00
23-year member
UID 204
Gender Male
Status Offline
Can I partition drive A?
Floor 5 Posted 2002-11-13 00:00 ·  中国 广东 佛山 三水区 电信
元老会员
★★★★
Credits 5,170
Posts 1,637
Joined 2002-10-16 00:00
23-year member
UID 8
Gender Male
From 广东佛山
Status Offline
It seems that < can also be a pipeline command. I remember seeing debugging techniques before. You can write the operations of DEBUG one by one into a text file, and then use DEBUB < file name. I don't know if I remembered it wrong, so I didn't mention it above.
我的网志
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos
Floor 6 Posted 2002-12-04 00:00 ·  中国 广东 广州 天河区 电信
初级用户
Credits 131
Posts 12
Joined 2002-12-04 00:00
23-year member
UID 403
Gender Male
Status Offline
<Is to use the following output as the input of the previous command
Floor 7 Posted 2002-12-04 00:00 ·  中国 广东 广州 天河区 电信
初级用户
Credits 132
Posts 15
Joined 2002-12-04 00:00
23-year member
UID 405
Gender Male
Status Offline
“>”, “>>”, a:\a.txt press Enter

After pressing Enter, the directory information in the DOS directory of drive C will be automatically saved to the a.txt file on drive A. Its content is the same as the screen information you see directly when you enter the dir command in the DOS directory of drive C.
Floor 8 Posted 2002-12-04 00:00 ·  中国 广东 广州 天河区 电信
初级用户
Credits 132
Posts 15
Joined 2002-12-04 00:00
23-year member
UID 405
Gender Male
Status Offline
">>" is additional content, similar to ">", but the difference is that ">" generates the result into a file, and if the target file already exists, it will be directly overwritten without prompting the user; while ">>" can append the result to the end of an existing file without overwriting the existing file.
"<" is the input redirection command. Generally, it needs to be used in conjunction with the three filter commands called filters in DOS.
Floor 9 Posted 2003-04-02 00:00 ·  中国 四川 成都 教育网
初级用户
&nbsp;弼马温
Credits 130
Posts 12
Joined 2003-03-29 00:00
23-year member
UID 1303
Gender Male
Status Offline
What you said is redirection, and the pipe is "|".
发生什么事了?
Floor 10 Posted 2003-04-04 00:00 ·  中国 安徽 合肥 电信
中级用户
Credits 272
Posts 43
Joined 2003-04-04 00:00
23-year member
UID 1392
Gender Male
Status Offline
What is “|” used for?
Floor 11 Posted 2003-08-23 00:00 ·  中国 湖南 长沙 电信
初级用户
Credits 188
Posts 23
Joined 2003-07-17 00:00
22-year member
UID 7056
Gender Male
Status Offline
Thank you very much. It would be even better if you could be more detailed.
Floor 12 Posted 2003-08-23 00:00 ·  中国 江苏 徐州 电信
初级用户
Credits 130
Posts 6
Joined 2003-08-15 00:00
22-year member
UID 8657
Gender Male
Status Offline
How do you use <?
Floor 13 Posted 2003-08-23 00:00 ·  中国 江苏 徐州 电信
初级用户
Credits 130
Posts 6
Joined 2003-08-15 00:00
22-year member
UID 8657
Gender Male
Status Offline
I don't know what the difference is between NUL and NULL.
Floor 14 Posted 2004-06-24 00:00 ·  中国 天津 电信
中级用户
Credits 297
Posts 44
Joined 2004-06-15 00:00
22-year member
UID 26749
Gender Male
Status Offline
Forum Jump: