soulin, on May 20 2005, 01:00 AM, said:
Your syntax will work - just add to the next row
:next
No, it doesn't, I tried that. It still continues to go through the rest of the alphabet even after matching the file. Then, after going through the alphabet it doesn't even set the variable, it tries to set the variable as "D: && goto next". It's weird, it will work in the XP version of the command prompt, but when I try it with the MS-DOS 7 boot disk, it doesn't.
EDIT: I did accomplish the task with this command:
SET CDROM=C
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=D
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=E
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=F
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=G
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=H
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=I
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=J
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=K
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=L
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=M
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=N
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=O
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=P
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=Q
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=R
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=S
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=T
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=U
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=V
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=W
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=X
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=Y
IF EXIST %CDROM%:\whatever.txt GOTO done
SET CDROM=Z
IF EXIST %CDROM%:\whatever.txt GOTO done
Still I would like to use the for command if at all possible.