First post, by Queen K Juul
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?