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-13 07:38
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » Help with this batch file problem View 573 Replies 1
Original Poster Posted 2004-02-15 00:00 ·  中国 广东 河源 电信
高级用户
★★
Credits 916
Posts 201
Joined 2003-05-04 00:00
23-year member
UID 1849
Gender Male
Status Offline
Boot the computer with a floppy disk. The contents of AUTOEXEC.BAT on the floppy are as follows:
for %%1 in (d e f g h i j k l m n o p q r s t u v w) do if exist %%1:\AUTOEXEC.BAT
%%1:

What I mean is, if AUTOEXEC.BAT exists in some partition, then switch to that partition's drive letter. For example, if AUTOEXEC.BAT exists on drive D, then after booting from the floppy it should switch to D:
But the way I wrote it above is wrong. Please help point out the mistake, thanks!
Floor 2 Posted 2004-02-16 00:00 ·  中国 河北 石家庄 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re walu:

This is a rather strange problem. The reason is that you wrote %%1: and for on two separate lines; just put them on one line and it will be fine.

Was it your own oversight? Or did you do it intentionally?
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: