Page 1 of 1 1
Topic Options
#10977 - 2001-07-28 12:26 AM Detecting existence of removable drive
Anonymous
Unregistered


Can anyone tell me how to detect the existence of a removable disk drive? I want to be able to search all drives on a given PC but exclude the removable drives (ie floppy, zip, CD...). If I use "IF EXIST..." on a zip drive that does not have a disk, a message box pops up stating "There is no disk in the drive..." and execution is halted until the user clicks on an Abort/Retry/Ignore button. The OS is WinNT 4.

Thanks

Top
#10978 - 2001-07-28 03:58 AM Re: Detecting existence of removable drive
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello Madman63,
Welcome to the board


Please see the MCA website. http://home.wanadoo.nl/scripting/index.htm

Then look for mappings.kix http://home.wanadoo.nl/scripting/download/mappings.kix

This should be able to do what your looking for. Give it a try and let us know.

[ 28 July 2001: Message edited by: NTDOC ]

Top
#10979 - 2001-07-30 05:20 PM Re: Detecting existence of removable drive
Anonymous
Unregistered


NTDOC,

Thanks for the reply. I tried your script, but when it looks for the zip drive it still halts execution and prompts me with "The drive is not ready for use; its door may be open... Abort/Retry/Ignore". Any ideas?

Thanks

Top
#10980 - 2001-07-30 05:34 PM Re: Detecting existence of removable drive
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I checked NTDOC's code a little bit and it seems to check the diskspace too, right?
so non existent zip floppy offcourse cause's error. that's also why it can't be queried.
it's just the same when you try to list with dir a: when floppy ain't present.

so the info you can get is that if the zip-drive is installed or not.

_________________________
!

download KiXnet

Top
#10981 - 2001-07-30 08:30 PM Re: Detecting existence of removable drive
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Whoa! hold up....

Sorry, but this is not my code. Good code, but it is MCAs code. I wish I could take credit for it. I only made some suggestions to MCA which he accepted.

You would probably need to check into an .EXE file that can query without setting the request info (my wording not real) flag. I know it can be done, in fact I think one of the real old batch enhancers GET was able to do it. Sorry MadMan, but unless someone else here on the board knows how, you will need to probably either search in the USENET or WWW for such a utility, or wait till MCA gets back and hope he takes a personal interest in helping you get this done.

I don't know how and would have to research it also.

Top
#10982 - 2001-07-31 04:58 PM Re: Detecting existence of removable drive
Anonymous
Unregistered


Funny how someone asks for stuff right after you make that very thing...

ftp://jasonc.no-ip.com/public/files/Upload/connections2.kix

I made this working against NT-4.0 only, 9x doesn't list out it's connections the way NT/2000 does.

All (SCSI/IDE) connections are listed out directly in the registry. My script simply reads the registry. It does nothing as per drive letters. This works for up to 2 scsi channels, none of my machines have 3 scsi so I didn't make it for 3 or more. It takes into account for wide scsi also (15 devices + the controller). Yes, scsi scanners are shown.

In my DEVICE_TYPE section I have listed about a dozen devices that I know about. Just copy and paist another line to add what you have discovered. CASE 1 takes care of anything not in the list.

As of now all output is to screen, however writing to a file is just a matter of adding redirectoutput. I'm also considereing using writeprofilestring to make the output in an INI format.

Welp, have fun...

[ 31 July 2001: Message edited by: JasonC ]

[ 31 July 2001: Message edited by: JasonC ]

Top
#10983 - 2001-07-31 06:19 PM Re: Detecting existence of removable drive
Anonymous
Unregistered


JasonC

Your script works as you said, but I need to know the drive letters assigned to these devices. Do you know how to get the drive letter assignments? The registry does not appear to list it for all devices (ie Zip drives).

Thanks

Top
#10984 - 2001-07-31 09:51 PM Re: Detecting existence of removable drive
Anonymous
Unregistered


Unless Windisk assigns a drive letter to the device it follows this rule:

Windows NT first assigns drive letters that you configured in Disk Administrator (Windisk.exe) by selecting the Volume and choosing Tools/Assign Drive .. (assuming the partition is still valid).

If there is a primary partition on the first hard drive marked as active, it gets the first available drive letter, otherwise, the first available drive letter is assigned to the first recognized primary partition.

This process is repeated for all hard drives in the system. Please note that if you have multiple controllers in your system, the drive letter ordering is based on the order in which the device drivers are loaded by Windows NT.

Once the letters have been assigned to the first primary partitions on all drives in the system, letters are assigned to the recognized logical disks in the extended partitions using the same scheme as outlined above, starting with the first drive in the system.

After all of the logical disks in the extended partitions are assigned letters, one last scan is made of the drives, and letters are assigned to any remaining recognized primary partitions.

Some removeable media devices are considered to be hard drives and participate in the above.

Lastly, removeable media devices (CD-ROM) are assigned.

If your new JAZ drive is messing up your drive letters:

Shutdown
Remove the JAZ
boot
Run Windisk and assign drive letters to all other devices
Shutdown
Attach the JAZ

Upon booting, you will find that the JAZ drive has the next available drive letter.

There is no entry in the registry you can read to see.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org