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-08-01 15:47
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » 【Help】 | Usage of pipe commands View 1,884 Replies 8
Original Poster Posted 2006-04-12 23:26 ·  中国 福建 厦门 联通
新手上路
Credits 10
Posts 3
Joined 2006-04-12 09:58
20-year member
UID 53698
Status Offline
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.
Floor 2 Posted 2006-04-13 02:32 ·  中国 上海 东方有线
中级用户
★★
Credits 377
Posts 66
Joined 2005-04-04 00:00
21-year member
UID 37817
Gender Male
Status Offline
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 ]
Floor 3 Posted 2006-04-13 09:18 ·  中国 重庆 巴南区 电信
高级用户
★★
Credits 772
Posts 273
Joined 2004-10-23 00:00
21-year member
UID 32861
Gender Male
Status Offline
Why go to so much trouble? You can just use echo to do it.
http://www.msfans.net/bbs/
Floor 4 Posted 2006-04-13 10:07 ·  中国 福建 厦门 电信
新手上路
Credits 10
Posts 3
Joined 2006-04-12 09:58
20-year member
UID 53698
Status Offline
Hehe. Thanks to the one on the 2nd floor. What does the one on the 3rd floor mean?
Floor 5 Posted 2006-04-13 15:57 ·  中国 福建 厦门 电信
新手上路
Credits 10
Posts 3
Joined 2006-04-12 09:58
20-year member
UID 53698
Status Offline
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.
Floor 6 Posted 2006-04-13 18:06 ·  美国
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Any command that uses standard input can use | to receive input. For example, the most commonly used ones:
echo. | time
echo y | format c:
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 7 Posted 2006-04-13 18:18 ·  美国
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
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.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 8 Posted 2006-04-13 18:18 ·  中国 上海 东方有线
中级用户
★★
Credits 377
Posts 66
Joined 2005-04-04 00:00
21-year member
UID 37817
Gender Male
Status Offline
mem/c|find "DOSLFN"/I
Floor 9 Posted 2006-04-15 00:44 ·  中国 山西 太原 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
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?
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: