JSI Tip 0801. Test If a Diskette drive is ready in a batch file.

Jerold Schulman

October 30, 1998

1 Min Read
ITPro Today logo in a gray background | ITPro Today


If you need to test wether a Diskette drive is ready in a batch script, download Drvready.

The syntax is: Drvready []

If no drive letter is specified, the A: drive is assumed.

Drvready.exe should be placed in your path. When executed, it returns ERRORLEVEL 0 if the drive is ready, ERRORLEVEL 1 if it is not ready, without causing a device not ready window to appear.

Sample usage:

...
...
:ready
drvready.exe
goto mount%ERRORLEVEL%
:mount1
@echo Mount an empty formated diskette in drive A:. Press enter when ready.
pause
goto ready
:mount0
If not exist A:*.* goto mt
@echo Diskette in drive A: is not empty, files exist.
goto mount1
:mt
...
...

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like