VOGONS


First post, by Queen K Juul

User metadata
Rank Newbie
Rank
Newbie

I'm writing a batch script (well, an AUTOEXEC.BAT) that checks all available CD drives for a certain file to see if a certain CD is in one of the drives.

I'm using a Windows 98 boot floppy, so DOS 7.10

My problem is that each time it checks an empty drive, I get "General Failure reading drive X" with the "Abort, Retry, Fail" prompt. If I just hit Abort, it will iterate through each drive, and then when it finds the disc, it proceeds the way I want.

It's just that the whole point of the script is that it's automatic, and I don't want to have to interact with it, so having to step through the Abort steps is kind of defeating the purpose. Also this project may eventually be shared with the public so I would like it to "just work"

I have tried two ways of checking for the file:

for /f %%a in (w x y z) do (
if exist %%a\file (
set cddrive=%%a
goto :continue
)
)
:continue

which I found here: https://www.dostips.com/forum/viewtopic.php?t=772

as well as

if exist W:\FILE set cddrive=W:
if exist X:\FILE set cddrive=Y:
if exist Y:\FILE set cddrive=X:
if exist Z:\FILE set cddrive=Z:

Both behave identically. The code works the way I want, I just don't want the error to occur. The problem arises when I have the CD in my second drive. In this case, W: is a valid drive letter, but the drive is empty, so reading from it fails. When I hit Abort, it moves on from W: to X:, finds the file, and proceeds as planned.

Is there any way to check if W:\ is valid without requiring the user to intervene on failure?

Reply 2 of 5, by Queen K Juul

User metadata
Rank Newbie
Rank
Newbie
shell=command.com /p /f

does the trick, in that the script proceeds as planned, but I would still prefer to suppress the error output (it even still prints the words "Abort, Retry, Fail", it just automatically aborts/fails)

It looks like the link to DREADY in that thread was removed, unfortunately.

Reply 5 of 5, by ludicrous_peridot

User metadata
Rank Member
Rank
Member

Not sure, how helpful this may be, esp since you seem to have found a solution already, but I have just recently responded in an adjacent thread with how I was solving a similar problem: Re: DOS Questions

EDIT: oh, ignore me: I was checking for presence of the drive (as in drive letter), not medium in the drive.

GA-G41M-Combo G41/ICH7 - Core 2 Quad Q9550 - DDR3 1033 - Radeon RX570 - YMF744 (Cobra) - X3MB (Buran)
Beetle/M/i815+ICH2 - Celeron 566Mhz - Opti 924 (Typhoon Media)