Newbie problem.
For some reason, I can't get this to work:
FOR /L %%A IN (1 1 23) DO (
if %%A==1 set drive=C:
if %%A==2 set drive=D:
if %%A==3 set drive=E:
if %%A==4 set drive=F:
if %%A==5 set drive=G:
if %%A==6 set drive=H:
if %%A==7 set drive=I:
if %%A==8 set drive=J:
if %%A==9 set drive=K:
if %%A==10 set drive=L:
if %%A==11 set drive=M:
if %%A==12 set drive=N:
if %%A==13 set drive=O:
if %%A==14 set drive=P:
if %%A==15 set drive=Q:
if %%A==16 set drive=S:
if %%A==17 set drive=T:
if %%A==18 set drive=U:
if %%A==19 set drive=V:
if %%A==20 set drive=W:
if %%A==21 set drive=X:
if %%A==22 set drive=Y:
if %%A==23 set drive=Z:
echo %drive%
if NOT "%systemdrive%"=="%drive%" format /q %drive%
)
If I were to simply "echo foobar" rather than "set drive=Z:", it will do so correctly. It just will not set the variable :(
Suggestions?
Thanks!