Getting a list of logical and physical drives from the command line

It’s often useful to know what logical and physical drives are available to Windows, and sometimes this needs to be done from the command line.

Logical drives

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 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.

Physical drives

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

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.

4 thoughts on “Getting a list of logical and physical drives from the command line

  1. J2u


    How can i extract the specific fields using wmic diskdrive or wmic logicaldisk.

    For example i want to output the size and number or partitions to a text file as follows:


  2. Michael

    I am trying to create a batch file that automatically select a USB drive if it has a caption ASMedia in its name using WMIC command. I am having problems getting the script to identify the drive so it can be place against a variable so I can then run a diskpart script to prepare it for Windows To Go. I can use Powershell but I dont want to write a script as this is blocked.

    Is there an easy statement that can use WMIC to capture the diskdrive and place the details into a variable I can use within Diskpart to prepare partitions.

    Sorry for it being wordy.

  3. Cvieira

    i think you need this
    for /F “usebackq tokens=1,2,3,4 ” %%i in (`wmic logicaldisk get caption^,description^,VolumeName 2^>NUL`) do (

    if %%l equ MID (
    echo %%i is a USB drive com o nome %%l.
    set android=%%i
    in this case i search for usb drive with name MID in your case you need to change to ASMEDIA
    sorry for the english

Leave a Reply

Your email address will not be published. Required fields are marked *