Batch determining if device is mounted

H

Howard Brazee

I want my batch file to determine whether my Dazzle memory card reader is
attached and a memory card is in it before it does the copying I need (to get
data back and forth from work).



ISDEVTST checks for devices and passes back return codes Googling, I found batch
files using it:
http://www.flash.net/~hoselton/pubs/mah_003.txt
http://www.robvanderwoude.com/

This works to tell me if the device driver has been loaded. But it doesn't
tell me if there is anything mounted.

I tried the following .bat segment:
C:\BELFRY>c:

C:\BELFRY>cd \belfry

C:\BELFRY>ISDEV.com I:

C:\BELFRY>If ErrorLevel 1 ECHO no I:

C:\BELFRY>If Not ErrorLevel 1 ECHO I:
I:

C:\BELFRY>dir i:
The device is not ready.

C:\BELFRY>If Not ErrorLevel 1 ECHO dir i:

C:\BELFRY>If Not ErrorLevel 1 pause

C:\BELFRY>pause
Press any key to continue . . .


How can I determine whether the device is mounted?
 
M

Mikhail Zhilin

Howard,

You can create a batch file (or VB-script with the same sence) with only
one additional line:

if not exist X:\nul exit
<main job is here>

where X: is the letter of the drive, that your memory card get when
inserted and working.

Or, if the diagnosic message is needed -- something like:

if exist X:\nul goto main
echo Card is not inserted!
pause
goto fin
:main
<main job is here>
:fin
exit

--
Mikhail Zhilin (MS MVP - Win9x)
http://www.aha.ru/~mwz
Sorry, no technical support by e-mail.
Please reply to the newsgroups only.
======
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top