WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

DiskScan Function Info

Keywords:    DIskScan removable devices DiskExist DiskFree xDriveReady 

Question on Diskscan and Checking if Drive is Ready:

A hopefully simple question. I'm currently writing an interface that needs to present a user with a list of available drives (both fixed and removable type) and I'm using DiskScan to generate the list of drives. However, DiskScan includes present but "empty" or inaccessible drives. Specifically there is a built in CF/SD type reader on this system which has several media slots and for which drive letters are reserved. But there is no media in the reader slots (and never will - we don't use those media types). If a user selects any of the drives that have no media in them and any of my code tries to operate against that drive selection, I get a fatal error that terminates the script. I was hoping that DiskExist() might let me determine that the drive was unavailable, but it doesn't. The drive is present, simply has no media! I have also tried changing errorMode to @OFF and doing both a dirChange() and a logDisk() with the selected letter to check the return value ... but even with errorMode set to @OFF, the script crashes. Does anyone have any suggestions as to how I might go about filtering these drives out of my list?

Answer:

Here is a method that uses the DiskScan Function to determine if a drive is ready.
drives = DiskScan( 1|2|64 )
count = ItemCount( drives, @TAB )
drivesready = ''
for i = 1 to count
   thisdrive = ItemExtract( i, drives, @TAB )
   ret = DiskSize( thisdrive )
   ; or
   ; ret = DiskFree( thisdrive )
   if ret == 0 then continue
   if drivesready =='' then drivesready = thisdrive
   else drivesready = drivesready : @TAB : thisdrive
next
AskItemList('Drives Ready', drivesready, @TAB, @SORTED, @SINGLE, @TRUE )
Exit
Here is a method that uses the xDriveReady WIL Extender Function to determine if a drive is ready.
; WILX EXTENDER xDriveReady
AddExtender( 'wilx44i.dll', 0, 'wilx64i.dll'); Load Appropriate Extender

drives = DiskScan( 1|2|64 )
count = ItemCount( drives, @TAB )
drivesready = ''
for i = 1 to count
   thisdrive = ItemExtract( i, drives, @TAB )
   ret = xDriveReady( thisdrive )
   if ret == 0 then continue
   if drivesready =='' then drivesready = thisdrive
   else drivesready = drivesready : @TAB : thisdrive
next
AskItemList('Drives Ready', drivesready, @TAB, @SORTED, @SINGLE, @TRUE )
Exit

Question on Diskscan and Removable Drives:

I have a question about the DiskScan command under the 32 bit version of WIL. The help file says that a mask value of 1 detects removable (floppy) drives. Will this mask return other removable media drives also, such as Zip, MO, PD, etc. ? If not, is there a mask value that should be used to detect these types ?

Answer:

Yes. Removable media include floppies, Zips and jaz drives. It actually up to the device driver to tell us if it is removable or not.

Question on Diskscan and Network Physical Drives:

This is probably a silly question but... I looked through the help files and can't seem to find a function similar to DiskScan for a neworked system.

I want to attach to a networked Server or workstation and determine how many devices are PHYSICALLY connected to it (ie: C:\, D:\, etc..).

I looked at netResources, but this only reports back resources that the server is CONNECTED to on the network.

Is there an extended version of DiskScan that works on a remote system?

Answer:

Sorry, no.
Article ID:   W13053
Filename:   Diskscan Function.txt
File Created: 2013:12:11:12:08:22
Last Updated: 2013:12:11:12:08:22