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-07-29 09:02
中国DOS联盟论坛 » 论坛回收站 » Problems with parentheses in the for command View 2,000 Replies 5
Original Poster Posted 2010-10-08 19:31 ·  中国 北京 广东恒敦通信技术北京分公司
初级用户
Credits 154
Posts 21
Joined 2005-01-19 00:00
21-year member
UID 35444
Gender Male
Status Offline
The commands are as follows:

for %%a in (1,2) do (
echo a() >1.txt
echo b() >>1.txt
)

The expected result is:
a()
b()

But the running result is:
a(
b()

There is a missing parenthesis. It is checked that the for command takes the closing parenthesis after a as the mark for the end of the command. How to solve this situation? Please help take a look, thank you very much!
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
DOSroot -6 2010-10-11 19:27
Floor 2 Posted 2010-10-08 23:48 ·  中国 上海 杨浦区 电信
管理员
★★
Credits 389
Posts 198
Joined 2008-09-23 12:00
17-year member
UID 126405
Gender Male
Status Offline
Are you in a DOS environment?
Floor 3 Posted 2010-10-09 09:28 ·  中国 北京 广东恒敦通信技术北京分公司
初级用户
Credits 154
Posts 21
Joined 2005-01-19 00:00
21-year member
UID 35444
Gender Male
Status Offline
Yes, the batch file of XP
Floor 4 Posted 2010-10-09 17:43 ·  中国 北京 广东恒敦通信技术北京分公司
初级用户
Credits 154
Posts 21
Joined 2005-01-19 00:00
21-year member
UID 35444
Gender Male
Status Offline
No one knows? ? ?
Floor 5 Posted 2010-10-10 01:53 ·  中国 上海 电信
管理员
★★
Credits 389
Posts 198
Joined 2008-09-23 12:00
17-year member
UID 126405
Gender Male
Status Offline
Originally posted by Climbing at 2004-11-25 00:00:
Read the stickied posts more.


http://www.cn-dos.net/forum/viewthread.php?tid=46409
Floor 6 Posted 2010-10-10 16:39 ·  中国 广东 广州 电信
新手上路
Credits 8
Posts 6
Joined 2010-09-30 22:18
15-year member
UID 175142
Gender Male
Status Offline
Remember replying on the bathhome website............

for %%a in (1,2) do (
echo a(^) >1.txt
echo b(^) >>1.txt
)
Forum Jump: