Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
How do I determine if Floppy is in drive?
I assume there is a interrupt 13 function that will do this.
Running msdos 7.1 from a program (VB dos) I would like to check if a floppy is in the drive. Without the Retry,Fail,Abort message.
A bit of code any language would help.
An example would be the VOL command. VOL A:

Hi
Would something like this work.
If there files on the disk you could change
the first line to :-
if exist a:\*.* goto found.if exist a: goto Found
echo Floppy Not Found
goto quit
:Found
echo Floppy Found
:quit

You can invoke a 2nd command.com with the undocumented /F switch which specifically is supposed to answer F for Fail to all errors created under that instance of the 2nd Command.com. What really happens is that you've got a broken new command.com instance that rarely does what it used to. Read buggy as buggy can get. But this appears to work here?
@echo off
command /f /c vol a:|find "label"
if not errorlevel 1 goto no_disk:disk
echo we gots a disk in it.
pause
exit:no_disk
echo there is no floppy inserted
pause
exit

under dos 7.1 (no windows)
the following works
------------------------
@echo off
ver
command /f /c vol b: | find "Ser" > NUL:
if errorlevel 0 set srcdrv=0
if errorlevel 1 set srcdrv=1
if errorlevel 2 set srcdrv=2
@echo the error level %srcdrv%
if errorlevel 1 goto no_disk
:disk
echo we gots a disk in it.
goto ppp
:no_disk
echo there is no floppy inserted
:ppp
-
This is the output
---- without disk in drive ---
C:\>test
Windows 98 [Version 4.10.2222]
Not ready reading drive B
Abort,Retry,Fail?the error level 1
there is no floppy inserted
C:\>
---- with disk in drive ---
C:\>test
Windows 98 [Version 4.10.2222]
the error level 0
we gots a disk in it.
C:\>
_____________________________
In a Microsoft Windows 2000 [Version 5.00.2195]
Command Prompt window the above does not work as the errorlevel return is always the same 0.
But my problem was / is strictly with a DOS environment.
So my work around in VB Dos was the following:
FUNCTION FloppyIn (drv$) AS INTEGER
DIM a$, b$, i%, j%
DIM DirFile%
FloppyIn = false 'assume NO
SHELL "command /f /c VOL B:> Q:\$DELETE$.ME$"
DirFile% = FREEFILE
OPEN "Q:\$DELETE$.ME$" FOR INPUT AS #DirFile%
DO UNTIL EOF(DirFile%)
LINE INPUT #DirFile%, a$
i% = INSTR(a$, "Serial")
IF i% <> 0 THEN
FloppyIn = true
EXIT DO
END IF
LOOP
CLOSE #DirFile%
KILL "Q:\$DELETE$.ME$"
END FUNCTION
============================
meelee5,
Thanks - working code is always beats elegance.
This does throw some junk on the screen but that can be hidden.
I was playing around with interrupt calls that would sort of work in a windows command prompt window but not in DOS.
again thanks!

Dack:
You should try dready.comUsage:
Dready.com [drive]Example:
---------
dready a:
if errorlevel 2 goto nodisk
---------

In case he wants to avoid third-party tools like DREADY, try this thread:
http://computing.net/dos/wwwboard/forum/13284.html

![]() |
Boot to DOS on second par...
|
FTP resume
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |