K
Kjetil Viggen
I am currently using the System.IO.DriveInfo class to go through the
available drives on the system:
var drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives)
{
System.IO.DriveType type = drive.DriveType;
...
}
My problem is that I want to skip any floppy drives in this enumeration (Yes
- there are still systems with floppy drives out there...). However DriveType
does not help me do this. From the documentation on the DriveType enumeration:
" Removable:
The drive is a removable storage device, such as a floppy disk drive or a
USB flash drive."
WMI probably has some options to do differentiate between different
removable drive types, but my previous experience with WMI has shown severe
problems there when running as non-administrator users. So I am reluctant to
try this...
Another possible option is to just skip if drive letter is A: or B:, as
these are reserved for floppies. But the Windows Knowledge Base says:
"Drive letters A and B are reserved for floppy disk drives. However, if your
computer does not have a floppy disk drive, you can assign these letters to
removable drives."
So that is not exactly waterproof either...
How can I easily check if a given drive is a floppy drive or not?
Kjetil.
available drives on the system:
var drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives)
{
System.IO.DriveType type = drive.DriveType;
...
}
My problem is that I want to skip any floppy drives in this enumeration (Yes
- there are still systems with floppy drives out there...). However DriveType
does not help me do this. From the documentation on the DriveType enumeration:
" Removable:
The drive is a removable storage device, such as a floppy disk drive or a
USB flash drive."
WMI probably has some options to do differentiate between different
removable drive types, but my previous experience with WMI has shown severe
problems there when running as non-administrator users. So I am reluctant to
try this...
Another possible option is to just skip if drive letter is A: or B:, as
these are reserved for floppies. But the Windows Knowledge Base says:
"Drive letters A and B are reserved for floppy disk drives. However, if your
computer does not have a floppy disk drive, you can assign these letters to
removable drives."
So that is not exactly waterproof either...
How can I easily check if a given drive is a floppy drive or not?
Kjetil.