中国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-09-23 16:40
47,812 topics / 349,917 posts / today 0 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » 【Help】 | Usage of pipe commands
Printable Version  1,993 / 8
Floor1 rivaldo Posted 2006-04-12 23:26
新手上路 Posts 3 Credits 10
I have searched, but it seems that the explanations are not very clear. It seems that the output of the previous one serves as the input of the next one.
Is there any expert who can help explain it clearly? It's better to have examples for easy understanding. Little brother thanks in advance.
Floor2 hxj Posted 2006-04-13 02:32
中级用户 Posts 66 Credits 377
The following is a batch script that someone modified the boot.ini. The usage of the | can be easily understood at a glance.
If there is no result before the |, the part after the | cannot be realized.
@echo off
type boot.ini>boot.bak
attrib -h -r -s boot.ini
type boot.bak|find "boot loader" /i>boot.ini
echo timeout=5 >>boot.ini
type boot.bak|find "boot loader" /i /v|find "timeout" /i /v>>boot.ini
attrib +s +r +h boot.ini

[ Last edited by hxj on 2006-4-13 at 02:37 ]
Floor3 chenhui530 Posted 2006-04-13 09:18
高级用户 Posts 273 Credits 772
Why go to so much trouble? You can just use echo to do it.
Floor4 rivaldo Posted 2006-04-13 10:07
新手上路 Posts 3 Credits 10
Hehe. Thanks to the one on the 2nd floor. What does the one on the 3rd floor mean?
Floor5 rivaldo Posted 2006-04-13 15:57
新手上路 Posts 3 Credits 10
There is another question: Is | only applicable to more, find, sort? Can it be used elsewhere? If it can, please give an example as well.
Floor6 Climbing Posted 2006-04-13 18:06
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
Any command that uses standard input can use | to receive input. For example, the most commonly used ones:
echo. | time
echo y | format c:
Floor7 Climbing Posted 2006-04-13 18:18
铂金会员 Posts 2,753 Credits 6,962 From 河北保定
Sorry, the website is too slow. I refreshed twice and there were three replies. Please ask the moderator to delete the three redundant replies. I can't delete the post I posted myself. Oh my god.
Floor8 hxj Posted 2006-04-13 18:18
中级用户 Posts 66 Credits 377
mem/c|find "DOSLFN"/I
Floor9 willsort Posted 2006-04-15 00:44
元老会员 Posts 1,512 Credits 4,432
Re Climbing:

The extra post has already been deleted. Also, regarding “you actually can’t delete your own post,” I wonder whether you tried going to the post’s “Edit” page, checking the “!Delete this post” option, and then confirming?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023