Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Checking whether parameter is a drive letter

0 views
Skip to first unread message

Esra Sdrawkcab

unread,
Jul 10, 2008, 5:05:28 AM7/10/08
to

If running on an intel box, with debug in the path (or it could be
converted to ascii asm), this would do it:

@echo off
rem qdrvl.bat

echo E100 A0 5C 00 B4 4C CD 21> %temp%\qdrvl.dis
echo Rcx>> %temp%\qdrvl.dis
echo 7 >> %temp%\qdrvl.dis
echo w >> %temp%\qdrvl.dis
echo q >> %temp%\qdrvl.dis
echo create>%temp%\qdrvl.com
debug %temp%\qdrvl.com<%temp%\qdrvl.dis >nul
%temp%\qdrvl.com %1
if errorlevel 243 goto isnumbercolon
if errorlevel 1 echo valid drive
if not errorlevel 1 echo Not a valid drive
goto exit
:isnumbercolon
echo number followed by colon detected!
:exit
::del %temp%\qdrvl.com
del %temp%\qdrvl.dis


though it seems the com parser is a bit crude and allows $: and £:

(X-posted to amb)

Rich Pasco

unread,
Jul 11, 2008, 5:54:52 PM7/11/08
to
Esra Sdrawkcab wrote:

Esra, while I appreciate your intention to help, I was asking for a
more elegant solution than my original one, which was just a few lines
in a BAT file. A debug script to generate a 16-bit DOS COM file (which
is only supported under 32-bit Windows for backwards compatibility) is
not, in my opinion, more "elegant" than I had.

Regarding the cross-post, I would prefer that discussion be constrained
to the forum in which I posted the question. I am not interested in
supporting MS-DOS anyway.

- Rich

Richard Bonner

unread,
Jul 14, 2008, 8:44:03 AM7/14/08
to
(For some reason no original post appeared on my serevr. As such, this
suggestion may not be valid for the purpose.)

One might use XSET 's "DRIVETEST" feature to determine if a parameter
is a valid drive.

The syntax is:

XSET TEST DRIVETEST A:

This will assign a variable to "TEST" such as:

READABLE
WRITEABLE
REMOVABLE
INVALID

...and a number of others. One could then test that variable for a
variety of outcomes.


One or more XSET links can be found at:

http://www.chebucto.ca/~ak621/DOS/Websites.html


Richard Bonner
http://www.chebucto.ca/~ak621/DOS/

Rich Pasco

unread,
Jul 14, 2008, 1:46:30 PM7/14/08
to Richard Bonner

Richard Bonner wrote:

> (For some reason no original post appeared on my serevr. As such, this
> suggestion may not be valid for the purpose.)

The original post was in microsoft.public.win2000.cmdprompt.admin
The cross-post to alt.msdos.batch was inappropriate.

> One might use XSET 's "DRIVETEST" feature to determine if a parameter

> is a valid drive....

Thank you, but the question was about doing it in a BAT script. I was
not looking for anything requiring an external executable helper app.

- Rich

Richard Bonner

unread,
Jul 14, 2008, 2:49:51 PM7/14/08
to
Rich Pasco (rich...@hotmail.com) wrote:

> Richard Bonner wrote:

> > (For some reason no original post appeared on my serevr. As such, this
> > suggestion may not be valid for the purpose.)

> The original post was in microsoft.public.win2000.cmdprompt.admin
> The cross-post to alt.msdos.batch was inappropriate.

*** Odd though that the cross-post did not appear on my server.
Normally, they do.


> > One might use XSET 's "DRIVETEST" feature to determine if a parameter
> > is a valid drive....

> Thank you, but the question was about doing it in a BAT script. I was
> not looking for anything requiring an external executable helper app.

> - Rich

*** OK. I am a big fan of using whatever is available and can do the
job, but understand if some cannot, or choose not to, use after-market
utilities.

I hope you locate what you need.

Richard Bonner
http://www.chebucto.ca/~ak621/DOS/

0 new messages