Here’s a handy command to return a list of logical drives in Windows.
wmic logicaldisk get caption,description,drivetype,providername,volumename
The Win32_LogicalDisk WMI class represents a data source that resolves to an actual local storage device on a computer system running Windows. While Caption, Description, DriveType, ProviderName, and VolumeName are useful in most cases, more properties are available, and a complete list is available at http://msdn.microsoft.com/en-us/library/windows/desktop/aa394173(v=vs.85).aspx. The output will be formatted as a table, the properties will be the column headings, and they will be placed into alphabetical order.
Caption is the drive letter of the logical disk. The Name property also returns the drive letter.
Description is the type of disk. For example: Local Fixed Disk, CD-ROM Disc, or Removable Disk.
DriveType is returned as an integer that corresponds to the type of disk drive the logical disk represents (and this matches the Description, making DriveType sort of superfluous).
0 = Unknown
1 = No Root Directory
2 = Removable Disk
3 = Local Disk
4 = Network Drive
5 = Compact Disc
6 = RAM Disk
ProviderName is the network path to the logical device.
VolumeName is the volume name of the logical disk.
And here is a command to return a list of physical drives.
wmic diskdrive list brief /format:list
The Win32_DiskDrive WMI class represents a physical disk drive as seen by a computer running Windows. Like the Win32_LogicalDisk WMI class, it has lots of properties, as listed at http://msdn.microsoft.com/en-us/library/windows/desktop/aa394132(v=vs.85).aspx.
For simplicity, though, and ease of reading in command window, wmic diskdrive list brief /format:list does the trick, particularly in combination with wmic logicaldisk.
1,355 total views, 1 views today