If you need to obtain a list of all disk drives on a Microsoft Windows system from a command line interface (CLI), e.g., a command prompt window, you can do so using Windows Management Instrumentation Command-line (WMIC). You can obtain a list of drives by opening a command prompt window and then issuing a
wmic logicaldisk get
command followed by parameters relevant to the information you
wish to see. You can see a list of parameter options by issuing the command
wmic logicaldisk get /?
.C:\>wmic logicaldisk get /? Property get operations. USAGE: GET [<property list>] [<get switches>] NOTE: <property list> ::= <property name> | <property name>, <property list> The following properties are available: Property Type Operation ======== ==== ========= Access N/A N/A Availability N/A N/A BlockSize N/A N/A Caption N/A N/A Compressed N/A N/A ConfigManagerErrorCode N/A N/A ConfigManagerUserConfig N/A N/A Description N/A N/A DeviceID N/A N/A DriveType N/A N/A ErrorCleared N/A N/A ErrorDescription N/A N/A ErrorMethodology N/A N/A FileSystem N/A N/A FreeSpace N/A N/A InstallDate N/A N/A LastErrorCode N/A N/A MaximumComponentLength N/A N/A MediaType N/A N/A Name N/A N/A NumberOfBlocks N/A N/A PNPDeviceID N/A N/A PowerManagementCapabilities N/A N/A PowerManagementSupported N/A N/A ProviderName N/A N/A Purpose N/A N/A QuotasDisabled N/A N/A QuotasIncomplete N/A N/A QuotasRebuilding N/A N/A Size N/A N/A Status N/A N/A StatusInfo N/A N/A SupportsDiskQuotas N/A N/A SupportsFileBasedCompression N/A N/A VolumeName N/A N/A VolumeSerialNumber N/A N/A The following GET switches are available: /VALUE - Return value. /ALL(default) - Return the data and metadata for the attribute. /TRANSLATE:<table name> - Translate output via values from <table name>. /EVERY:<interval> [/REPEAT:<repeat count>] - Returns value every (X interval) seconds, If /REPEAT specified the command is executed <repeat count> times. /FORMAT:<format specifier> - Keyword/XSL filename to process the XML results. NOTE: Order of /TRANSLATE and /FORMAT switches influences the appearance of output. Case1: If /TRANSLATE precedes /FORMAT, then translation of results will be followed by formatting. Case2: If /TRANSLATE succeeds /FORMAT, then translation of the formatted results will be done. C:\>
For example, the results from issuing the command on a Windows 10 system to display the device ID, volume name, and description are shown below:
C:\>wmic logicaldisk get deviceid, volumename, description Description DeviceID VolumeName Local Fixed Disk C: OS CD-ROM Disc D: CD-ROM Disc E: Removable Disk F: EMTEC C:\>
[ More Info ]