Show all drives in command prompt

windows cmdIf you work with the Windows command prompt and want to copy files from or to a USB flash drive, then you get a problem. So how to show all drives in the commandline (cmd) from Windows? Without a list of all the drives you won’t know the drive letter of the USB flash drive and without this you won’t be able to access it.

The cmd itself doesn’t provide a command for listing all available drives. However, you can get this task done by using wmic, a command line program, which provides you access to the WMI classes by command line. And so the solution to the question is quite simple.

To show all drives in the cmd use the following command:

wmic logicaldisk get deviceid, volumename, description

List all drives in cmd

Filter drives by type

If you want to show only drives of a particular type, the wmic command can be further expanded to include a where clause.

wmic logicaldisk where drivetype=2 get deviceid, volumename, description

Show all drives in CMD

The above command shows, for example, all removable drives. To select a different type of drive, you have to use another value instead of the 2. An overview of the possible values/drivetypes can be ​​found below:

  • 0 => Unknown
  • 1 => No Root Directory
  • 2 => Removable Disk
  • 3 => Local Disk
  • 4 => Network Drive
  • 5 => Compact Disc
  • 6 => RAM Disk

If you need more information or want to solve harder tasks you can read on right over here.

About the author: This article, as well as 177 more on en.code-bude.net, were published by Raffi. – Since 2011 I've been blogging here and on code-bude.net, the german counterpart, about programming and my software, write tutorials and try to share my knowledge, as well as possible, with my readers. Furthermore I write at derwirtschaftsinformatiker.de on subjects of my studies.
  //    •  • Facebook  • Twitter

  1. […] yet the program version # did. Version of these programs I simply download them again. 1. 10. Show all drives in command prompt. If you work with the Windows command prompt and want to copy files from or to a USB flash drive, […]

  2. D.Alves says:

    Thanks a bunch m8. This was just what I was looking for. kudos

  3. Subbu says:

    I disabled AbBlock on your site so that some ads can be enabled. But alas, this page has dependencies/references to googleanalytics, googlesyndication, facebook, linkedin, twitter, etc….

    Sorry, I had to enable Adblock on this site again.

  4. Hans says:

    Use “net use” to show all network drives and spin thru the list with FOR /F. Or use Powershell.

  5. O.G. says:

    Very useful.


  6. calin says:

    Thanks man, it is useful!