中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-18 10:33
47,814 topics / 349,907 posts / today 0 new / 48,259 members
DOS学习入门 & 精彩文章 (教学室) » Introduction to the Pipe Commands of DOS
Printable Version  5,141 / 13
Floor1 MYS Posted 2002-11-05 00:00
元老会员 Posts 1,637 Credits 5,170 From 广东佛山
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.
Floor2 流氓企鹅 Posted 2002-11-10 00:00
中级用户 Posts 82 Credits 312
Seems very dangerous.
Floor3 ko20010214 Posted 2002-11-10 00:00
版主 Posts 1,628 Credits 7,296
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...
Floor4 流氓企鹅 Posted 2002-11-13 00:00
中级用户 Posts 82 Credits 312
Can I partition drive A?
Floor5 MYS Posted 2002-11-13 00:00
元老会员 Posts 1,637 Credits 5,170 From 广东佛山
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.
Floor6 donaldtone Posted 2002-12-04 00:00
初级用户 Posts 12 Credits 131
<Is to use the following output as the input of the previous command
Floor7 老菜 Posted 2002-12-04 00:00
初级用户 Posts 15 Credits 132
“>”, “>>”, 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.
Floor8 老菜 Posted 2002-12-04 00:00
初级用户 Posts 15 Credits 132
">>" 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.
Floor9 banach Posted 2003-04-02 00:00
初级用户 Posts 12 Credits 130
What you said is redirection, and the pipe is "|".
Floor10 superdos Posted 2003-04-04 00:00
中级用户 Posts 43 Credits 272
What is “|” used for?
Floor11 YP7351 Posted 2003-08-23 00:00
初级用户 Posts 23 Credits 188
Thank you very much. It would be even better if you could be more detailed.
Floor12 ssbird Posted 2003-08-23 00:00
初级用户 Posts 6 Credits 130
How do you use <?
Floor13 ssbird Posted 2003-08-23 00:00
初级用户 Posts 6 Credits 130
I don't know what the difference is between NUL and NULL.
Floor14 laochang409 Posted 2004-06-24 00:00
中级用户 Posts 44 Credits 297
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023