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-02 04:44
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » What does "if command extensions are enabled" in the command line mean? View 1,593 Replies 6
Original Poster Posted 2006-09-12 22:18 ·  中国 黑龙江 哈尔滨 中移铁通
初级用户
Credits 168
Posts 22
Joined 2004-11-18 00:00
21-year member
UID 33761
Gender Male
Status Offline
I'm a newbie, and I don't understand this sentence. I saw it when learning the for command.

Also, can someone give a tutorial on the for command? What I found online is either just copying the help of for or written incorrectly. I copied the example it gave and it didn't run, and even copied it and it didn't run. Ugh. Thanks, thanks.
Floor 2 Posted 2006-09-12 22:23 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
Look at here:
http://www.cn-dos.net/forum/viewthread.php?tid=19331&fpage=1&highlight=%2Bbagpipe

Maybe you will have a new understanding of the FOR command ........
我今后在论坛的目标就是做个超级坏人!!!
Floor 3 Posted 2006-09-12 22:30 ·  中国 黑龙江 哈尔滨 中移铁通
初级用户
Credits 168
Posts 22
Joined 2004-11-18 00:00
21-year member
UID 33761
Gender Male
Status Offline
Thanks

But I still can't run its example, please help see what's wrong: (I copied it up.)

klot\>for %a in (c: d: e: f do @dir %a\   find "bytes free"
More?
More?
More?

klot\>for %a in (c: d: e: f do @dir %a\ find "bytes free"
More?

klot\>for %a in (c: d: e: f do @dir %a\ find "bytes free" )
The syntax of the command is incorrect.

klot\>

[ Last edited by klot on 2006-9-12 at 22:33 ]
Floor 4 Posted 2006-09-12 23:25 ·  中国 北京 联通
银牌会员
★★★
努力做坏人
Credits 1,185
Posts 438
Joined 2006-08-28 12:00
19-year member
UID 61449
From 北京
Status Offline
I advise you to study his grammar, don't be eager to execute and debug his commands. Try executing this: for %a in (c: d: e:) do @dir %a\|find "available bytes"
Before the following statement is effective, you need to execute CHCP 437 and then execute the following code, because he uses "bytes free" as the search condition: for %a in (c: d: e:) do @dir %a\|find "bytes free"
我今后在论坛的目标就是做个超级坏人!!!
Floor 5 Posted 2006-09-13 00:34 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
“bytes free” is the screen display in English state, and it is impossible to appear in the CMD in your Chinese state.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 6 Posted 2006-09-13 01:36 ·  中国 黑龙江 哈尔滨 中移铁通
初级用户
Credits 168
Posts 22
Joined 2004-11-18 00:00
21-year member
UID 33761
Gender Male
Status Offline
Thanks for the guidance.
I didn't want to run the code at first either, but if I didn't run it, I couldn't see the effect, and I didn't really believe if the code in the tutorial would work. Like me, who is so noob, I probably can't spot wrong code, so I had to run it. Isn't practice the best way to understand things, heh.

Finally, thanks to both of you for the help.

This is the result after I ran it, and it worked:)
klot\>for %a in (c: d: e:) do @dir %a\|find "bytes free"
4 Dir(s) 1,807,380,480 bytes free
8 Dir(s) 2,930,888,704 bytes free
10 Dir(s) 3,651,493,888 bytes free

[ Last edited by klot on 2006-9-13 at 01:41 ]
Floor 7 Posted 2006-09-13 05:38 ·  中国 甘肃 张掖 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
Practice is the best way to understand things

Hehe, that's what it is said, but the condition is when you have a general understanding
Forum Jump: