|Here's how it basically works....|
Firstly there are two different routines, one for vista and one for xp, for extracting the id and drive info. Both are located under "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USBSTOR" on vista the device id's are the names of it's subkeys and the drive info are the "friendlyname" value of that subkey. On xp the subkey isn't the device id, the value of "parentidprefix" on the subkey is the device id and the friendly name is the same.
Each of these values is looped through and assigned to incremented variables, id!fcnt! and fname!dcnt! where !dcnt! is an incrementing counter.
The rest of the procedure is the same for both xp and vista.
The id's can also be found in the hex data under "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices" along with the corresponding drive letter. The hex data is assigned to a different set of incrementing variables drvltt!lcnt! and drvdat!lcnt! and drvdat!lcnt! is converted from hex to ascii.
Using the for /l commands the total of the counters is used to loop through all of the variables that were created and match the drive info and drive letter by using the find command to find the device id in the converted hex data, thus matching the drive letter to the drive info, then the dir command is used to ensure the drive is present.
Entries are then sorted by drive letter so the final list is ordered, more for cosmetic purposes than anything else.
Entries are then displayed and chosen, the drive letter is the separated from the selected string and set to the %fdrive% variable.
Volume labels are also added to the output in my more recent version.
It really depends how usb hard drives would fit into this whole process as to how easily they can be added........
I didn't realize that you were using this at a public terminal, please run the reg dumps from the cleanest machine possible, I don't want to wade through 1000's of usb flash drive leftovers... Oh and if you could run it once for vista and once for xp that would be great, as I would like to keep it working on both systems.....
I didn't really answer one of you questions very well, the reason it focuses on flash drives is because it only looks for the information eluding to them under hklm\SYSTEM\CurrentControlSet\Enum\USBSTOR, I believe that usb hard drives will also have their information here but may use different value names, i.e. friendly name may be called something else or their id string may also be somewhere else.....
Oh and one drive is enough, knowing it's letter would also be of some value. You know this situation is like very similar to how it ended up supporting vista he he ;).