中国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-13 03:00
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS学习入门 & 精彩文章 (教学室) » Encountered a problem when creating a batch file with ECHO!
Printable Version  1,973 / 10
Floor1 vk Posted 2006-08-15 10:47
中级用户 Posts 86 Credits 218
echo ipconfig&ping 163.com>>aaa.bat
After running, a batch file named aaa will be created, but the content inside is the result of ping 163.com instead of the content "ipconfig&ping 163.com"?
Floor2 xjmxjm1234 Posted 2006-08-15 21:54
中级用户 Posts 166 Credits 361
Try this
echo ipconfig>aaa.bat
echo &>>aaa.bat
echo ping 163.com>>aaa.bat

[ Last edited by xjmxjm1234 on 2006-8-16 at 13:00 ]
Floor3 namejm Posted 2006-08-16 10:43
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Because & means executing simultaneously, so the meaning of the top post is to display the result of ipconfig and at the same time write the result of ping into aaa.bat.
Floor4 brglng Posted 2006-08-16 15:49
银牌会员 Posts 466 Credits 1,200 From 上海
echo ipconfig ^& ping 163.com >>aaa.bat
Check if this works (under 2K/XP)
Floor5 IceCrack Posted 2006-08-16 16:33
中级用户 Posts 168 Credits 332 From 天涯
This is another problem with escaping. It is suggested that the owner of the post search for "escaping" on the forum.
Floor6 itieim Posted 2007-04-19 05:46
新手上路 Posts 9 Credits 18
Dude, do you really have to do this all in one line?
How about this:
Floor7 htysm Posted 2007-04-19 08:04
高级用户 Posts 415 Credits 866
The result you provided above is not what the original poster wanted. ^O^
Floor8 xxff111 Posted 2007-04-19 09:25
新手上路 Posts 2 Credits 4
ipconfig>aaa.bat
&>>aaa.bat
ping 163.com>>aaa.bat
It should be written like this. If you add echo in front, it won't display the desired result.
Floor9 lxmxn Posted 2007-04-19 10:19
版主 Posts 4,938 Credits 11,386
The fourth floor is correct. Why don't you look at the fourth floor?
Floor10 vk Posted 2007-04-19 22:05
中级用户 Posts 86 Credits 218
This is a question I asked a long time ago. Now I have understood it. Thank you everyone for your enthusiastic answers!
Floor11 debug Posted 2007-12-02 18:30
初级用户 Posts 16 Credits 32
echo ipconfig"&"ping 163.com>>aaa.bat
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023