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-20 09:34
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » The Strongest DOS Command – for (It is a good resource for novices to learn the FOR statement) View 53,111 Replies 259
Floor 16 Posted 2006-11-05 01:56 ·  中国 广东 茂名 电信
中级用户
★★
Credits 261
Posts 123
Joined 2006-06-06 19:23
20-year member
UID 56648
Status Offline
Floor 17 Posted 2006-11-06 16:05 ·  中国 湖北 宜昌 电信
初级用户
Credits 30
Posts 26
Joined 2006-10-25 12:39
19-year member
UID 68219
Gender Male
Status Offline
Great, learned something.
Floor 18 Posted 2006-11-07 02:37 ·  中国 江西 南昌 电信
初级用户
Credits 34
Posts 16
Joined 2006-10-14 00:05
19-year member
UID 65659
Gender Male
Status Offline
The for /f "tokens=1" %i in ("C:\1.txt") do (echo 成功) works when entered directly in DOS, but doesn't work when made into a batch file. It says "There should not be \h.txt here") do (echo 成功)." What to do about it? Who can help me solve this problem~~
Floor 19 Posted 2006-11-07 05:33 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Floor 20 Posted 2006-11-07 10:40 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
In batch processing, parameters should be escaped with the % sign. For example, %i at the command line should be written as %%i in a batch script, and %a should be written as %%a.
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
hxuan999 +1 2006-11-17 06:34
Floor 21 Posted 2006-11-08 07:26 ·  中国 福建 龙岩 电信
初级用户
Credits 59
Posts 27
Joined 2006-10-18 11:17
19-year member
UID 66354
Status Offline
Floor 22 Posted 2006-11-09 23:06 ·  中国 北京 深圳南凌科技发展有限公司
新手上路
Credits 12
Posts 5
Joined 2006-11-08 02:20
19-year member
UID 69970
Gender Male
Status Offline
Floor 23 Posted 2006-11-12 22:17 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
新手上路
Credits 10
Posts 5
Joined 2006-10-23 01:44
19-year member
UID 67787
Gender Male
Status Offline
I'm a newbie. Let's learn. Thanks.
Floor 24 Posted 2006-11-13 05:41 ·  中国 天津 红桥区 联通
初级用户
Credits 34
Posts 20
Joined 2006-10-15 08:57
19-year member
UID 65839
Status Offline
Thanks
Floor 25 Posted 2006-11-16 00:10 ·  中国 上海 电信
中级用户
★★
Credits 252
Posts 56
Joined 2003-12-29 00:00
22-year member
UID 14605
Gender Male
Status Offline
The thing I've been wanting to find all the time
Floor 26 Posted 2006-11-16 12:00 ·  中国 广西 梧州 联通
新手上路
Credits 4
Posts 2
Joined 2006-11-16 11:12
19-year member
UID 70682
Gender Male
Status Offline
Support!!! The FOR statement is really powerful
Floor 27 Posted 2006-11-17 06:35
中级用户
★★
DOS之日
Credits 337
Posts 161
Joined 2006-11-04 05:27
19-year member
UID 69523
Gender Male
Status Offline
That's really good, I'll take it. Is there a more advanced method, heh.
for /f %%h in (`echo hxuan`) do for /f %%x in (`echo hxuan`) do if %%h==%%x nul
Floor 28 Posted 2006-11-18 05:48 ·  中国 江西 赣州 电信
新手上路
Credits 4
Posts 2
Joined 2006-10-19 23:34
19-year member
UID 67045
Status Offline
First time to know the function of for. Oh my!
Floor 29 Posted 2006-11-18 08:18 ·  中国 青海 海东 电信
新手上路
Credits 4
Posts 2
Joined 2006-11-18 04:57
19-year member
UID 70916
Gender Male
Status Offline
Floor 30 Posted 2006-11-18 08:18 ·  中国 青海 海东 电信
新手上路
Credits 4
Posts 2
Joined 2006-11-18 04:57
19-year member
UID 70916
Gender Male
Status Offline
Are there any other good things?
Forum Jump: