Ed Dyreen wrote:'
I've studied the BennyLevel, I never ran the code but it seems he determines the character of a variable using the the fact that choice will accept only the first choice.If it does what I think it does, this trick has become abundant.Code: Select all
@Echo. Fully specified file name.| CHOICE /n /c:abcdefgh.> NUL
For %%D in (A B C D E F G H ) do if errorlevel H%%D set D=%%D
Echo. The drive letter in your Fully specified file name: %D%
I see it mentioned here
http://groups.google.com/group/alt.msdo ... derson+dos
@echo off
choice/n/c abcdefghijklmnopqrstuvwxyz Choose:
if not errorlevel 17 goto end
for %%b in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if errorlevel %%b set drive=%%b
vol %drive%: | find "%drive% "
:end
set drive=
I get the idea..
Looks like in NT you can't test errorlevel against a letter. So his method doesn't apply to NT..
How do you think it is superfluous though?
I'd think it looks rather superfluous because with SET /P drive=
and then you test the value of drive without using errorlevel
If you just used CHOICE(in NT's case, choice.exe) and you didn't use SET /P then I guess it'd be a problem, 'cos I can't see how it can be done in NT otherwise?