Given the letter of a drive, how can I determine what type of drive it is?
For example, whether E:\ is a USB drive, a network drive or a local hard drive.
Given the letter of a drive, how can I determine what type of drive it is?
For example, whether E:\ is a USB drive, a network drive or a local hard drive.
Just for reference for anyone else, this is what I turned GenericTypeTea's answer into:
(You might want also take note of A.J.Bauer's answer: DriveInfo will also list USB HDs as DriveType.fixed)
Have a look at DriveInfo and DriveType
Have a look at
DriveInfo
'sDriveType
property.DriveType shows SUBSTed drives also as
DriveType.Fixed
.To check if a drive is substed I use the code How to determine if a directory path was SUBST'd.
DriveInfo will also list USB HDs as DriveType.fixed, so this doesn't help if you need to know if a drive's interface is USB or not. Here is a VB.NET function that returns all external USB drive letters:
See this MSDN link: WMI Tasks: Disks and File Systems