|
MYS
元老会员
        
积分 5170
发帖 1637
注册 2002-10-16 来自 广东佛山
状态 离线
|
『楼 主』:
DOS的管道命令简介
使用 LLM 解释/回答一下
DOS的管道命令简介
凭记忆写的,有错漏请各位指出或补充。
DOS的管道命令作用是将软件的输出重定向,使用它们我们可以很容易地截获DOS软件的输出信息。
例如,我想写一篇关于DOS的COPY命令的文章,需要用到它的参数资料,我可用copy /? >mycopy.txt,命令,就把COPY命令的帮助信息输入到文本文件mycopy.txt中,我只要对mycopy.txt进行修改就可以成为的我的文章了。
假如我还要写到XCOPY命令,我可以用xcopy /? >>mycopy.txt,又可以得到XCOPY命令的参数资料,>>和>的差别在于,假如目标文件mycopy.txt不是空的,>>会将新的内容附加到原有内容之后,而>则会将原有的内容冲掉。>和>>就是DOS管道命令的专用符号。
由于DOS把设备也作为文件处理,包括空目标NUL,所以,管道命令也可以用来做一些其他的工作。
如:type autoexec.bat >prn OR type autoexec.bat >lpt1 可简单测试打印机
copy command.com d:\ >nul 将command复制到D盘,不要出现任何信息
如果你的autoexec.bat中被写入DELTREE /Y C:\*.* >NULL,下次开机时你将会在硬盘灯一阵狂闪之中失去失C盘上全部资料,而屏幕上没有任何的提示信息。
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
|
|
2002-11-5 00:00 |
|
|
流氓企鹅
中级用户
   imp
积分 312
发帖 82
注册 2002-11-9
状态 离线
|
|
2002-11-10 00:00 |
|
|
ko20010214
版主
       
积分 7294
发帖 1628
注册 2002-10-16
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
deltree,delete,format,fdisk这四条DOS命令是比较危险的命令,如果没弄明白还是不要轻易尝试。但如果你知道你做的是什么那是另外一码事了。
多看看书,了解一下各种命令,然后再小心地试吧。。。前两条可以试。后面那两个。。。不懂的话还真不要去试。
要试也用虚拟机去试吧。呵呵。。。
其它DOS命令是不危险的。管道命令更谈不上危险。
我认为管道命令还应该加上|。
|也是一个管道命令,它的作用是将几条DOS命令放在一行中执行。(我是这样理解的。)
大家可以试试看。。。
比如:
你在c:\ccdos目录下,里面有ccdos.exe和ccdos.txt两个文件。
你dir的结果是:
.
..
ccdos.exe
ccdos.txt
然后我们键入:
copy ccdos.txt eg.txt|del ccdos.exe
执行后再dir一下:
变成了:
.
..
ccdos.txt
eg.txt
说明什么呢?这一行执行了两条DOS命令,呵呵。。。
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网卡 | 四合一读卡器
|
|
2002-11-10 00:00 |
|
|
流氓企鹅
中级用户
   imp
积分 312
发帖 82
注册 2002-11-9
状态 离线
|
|
2002-11-13 00:00 |
|
|
mys
元老会员
        
积分 5170
发帖 1637
注册 2002-10-16 来自 广东佛山
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
好象<也可以是个管道命令,记得以前看过debug的技巧,可以把DEBUG的操作一句句写进文本文件,然后用DEBUB < 文件名 就可以了。我也不知是否有记错,所以在上面没有提及。
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
|
|
2002-11-13 00:00 |
|
|
donaldtone
初级用户
 
积分 131
发帖 12
注册 2002-12-4
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
<是将后面的输出,作为前面命令的输入
<Is to use the following output as the input of the previous command
|
|
2002-12-4 00:00 |
|
|
老菜
初级用户
 
积分 132
发帖 15
注册 2002-12-4
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
“>”,“>>”,“ a:\a.txt回车
回车后,c 盘dos目录下的目录信息就会自动保存到A盘的a.txt文件中。其内容就像直接在c 盘dos目录下输入dir命令后在显示器所看到的屏幕信息一样。
“>”, “>>”, 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.
|
|
2002-12-4 00:00 |
|
|
老菜
初级用户
 
积分 132
发帖 15
注册 2002-12-4
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
">>"是追加内容,与“>”类似,不同的是,“>”是将结果生成一个文件,同时,如果目标文件已存在,那将被直接覆盖而不提醒用户;而“>>”则可以将结果追加到一个已有文件的末尾,不会覆盖已有文件。
“<”是输入重定向命令。一般要配合DOS中称为过滤器的三个过滤命令一起使用。
">>" 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.
|
|
2002-12-4 00:00 |
|
|
banach
初级用户
  弼马温
积分 130
发帖 12
注册 2003-3-29
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
你说的是重定向,管道是"|"。
What you said is redirection, and the pipe is "|".
|

发生什么事了? |
|
2003-4-2 00:00 |
|
|
superdos
中级用户
  
积分 272
发帖 43
注册 2003-4-4
状态 离线
|
|
2003-4-4 00:00 |
|
|
YP7351
初级用户
 
积分 188
发帖 23
注册 2003-7-17
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
非常感谢.能详细一点就更好了.
Thank you very much. It would be even better if you could be more detailed.
|
|
2003-8-23 00:00 |
|
|
ssbird
初级用户
 
积分 130
发帖 6
注册 2003-8-15
状态 离线
|
|
2003-8-23 00:00 |
|
|
ssbird
初级用户
 
积分 130
发帖 6
注册 2003-8-15
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
不知 NUL 和 NULL又有何区别?
I don't know what the difference is between NUL and NULL.
|
|
2003-8-23 00:00 |
|
|
laochang409
中级用户
  
积分 297
发帖 44
注册 2004-6-15
状态 离线
|
|
2004-6-24 00:00 |
|