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-06-22 18:20
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Encountered a problem when creating a batch file with ECHO! View 1,899 Replies 10
Original Poster Posted 2006-08-15 10:47 ·  中国 上海 东方有线
中级用户
★★
Credits 218
Posts 86
Joined 2006-08-10 10:45
19-year member
UID 60205
Gender Male
Status Offline
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"?
Floor 2 Posted 2006-08-15 21:54 ·  中国 上海 闵行区 电信
中级用户
★★
论坛第一菜鸟
Credits 361
Posts 166
Joined 2006-04-15 13:23
20-year member
UID 53870
Status Offline
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 ]
Diskette Operating System
Floor 3 Posted 2006-08-16 10:43 ·  中国 四川 成都 鹏博士宽带
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
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.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 4 Posted 2006-08-16 15:49 ·  中国 上海 杨浦区 电信
银牌会员
★★★
永遠的DOS~~~
Credits 1,200
Posts 466
Joined 2005-02-01 00:00
21-year member
UID 35867
Gender Male
From 上海
Status Offline
echo ipconfig ^& ping 163.com >>aaa.bat
Check if this works (under 2K/XP)
32位才是DOS未来的希望
个人网志:http://sololand.moe
Floor 5 Posted 2006-08-16 16:33 ·  中国 辽宁 大连 教育网
中级用户
★★
DOS之友
Credits 332
Posts 168
Joined 2005-10-06 00:00
20-year member
UID 43171
Gender Male
From 天涯
Status Offline
This is another problem with escaping. It is suggested that the owner of the post search for "escaping" on the forum.
测试环境: windows xp pro sp2 高手是这样炼成的:C:\WINDOWS\Help\ntcmds.chm
Floor 6 Posted 2007-04-19 05:46 ·  中国 北京 中国中信股份有限公司
新手上路
Credits 18
Posts 9
Joined 2007-04-15 01:58
19-year member
UID 85199
Gender Male
Status Offline
Dude, do you really have to do this all in one line?
How about this:
ipconfig > 163.txt & ping 163.com >> 163.txt
Floor 7 Posted 2007-04-19 08:04 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
The result you provided above is not what the original poster wanted. ^O^
欢迎你到批处理爱好者联盟QQ群:18023953
Floor 8 Posted 2007-04-19 09:25 ·  中国 福建 福州 电信
新手上路
Credits 4
Posts 2
Joined 2007-04-19 08:33
19-year member
UID 85720
Gender Male
Status Offline
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.
Floor 9 Posted 2007-04-19 10:19 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
The fourth floor is correct. Why don't you look at the fourth floor?
Floor 10 Posted 2007-04-19 22:05 ·  中国 上海 东方有线
中级用户
★★
Credits 218
Posts 86
Joined 2006-08-10 10:45
19-year member
UID 60205
Gender Male
Status Offline
This is a question I asked a long time ago. Now I have understood it. Thank you everyone for your enthusiastic answers!
Floor 11 Posted 2007-12-02 18:30 ·  中国 山西 移动
初级用户
Credits 32
Posts 16
Joined 2007-11-28 21:00
18-year member
UID 104093
Gender Male
Status Offline
echo ipconfig"&"ping 163.com>>aaa.bat
Forum Jump: