Computing.Net > Forums > Disk Operating System > How do I determine if Floppy is in

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

How do I determine if Floppy is in

Reply to Message Icon

Name: Dack
Date: February 17, 2004 at 05:31:41 Pacific
OS: DOS
CPU/Ram: PIII 733 / 512mb
Comment:

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:




Sponsored Link
Ads by Google

Response Number 1
Name: dtech
Date: February 17, 2004 at 15:40:34 Pacific
Reply:

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



0

Response Number 2
Name: melee5
Date: February 18, 2004 at 05:37:27 Pacific
Reply:

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


0

Response Number 3
Name: Dack_
Date: February 18, 2004 at 14:26:27 Pacific
Reply:

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!





0

Response Number 4
Name: roytam1
Date: February 19, 2004 at 05:39:04 Pacific
Reply:

Dack:
You should try dready.com

Usage:
Dready.com [drive]

Example:
---------
dready a:
if errorlevel 2 goto nodisk
---------


0

Response Number 5
Name: Wengier
Date: February 19, 2004 at 12:29:03 Pacific
Reply:

In case he wants to avoid third-party tools like DREADY, try this thread:

http://computing.net/dos/wwwboard/forum/13284.html


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Boot to DOS on second par... FTP resume



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: How do I determine if Floppy is in

How do i copy and paste files in ms-dos www.computing.net/answers/dos/how-do-i-copy-and-paste-files-in-msdos/8932.html

How do i get the 'c' prompt in dos?? www.computing.net/answers/dos/how-do-i-get-the-c-prompt-in-dos-/10211.html

how do i slow down my dos games? www.computing.net/answers/dos/how-do-i-slow-down-my-dos-games/6787.html