Windows cmd show all disks

  • Home
  • Partition Manager
  • CMD List Drives: How to List Drives in Command Prompt? [Answered]

By Ariel | Follow |
Last Updated

Sometimes you may to need list all drives on your systems. How to list drives in CMD/PowerShell? This post of MiniTool provides a full guide on PowerShell/CMD list drives and a professional tool to manage your drives.

When formatting a drive or copying files from a drive to another drive, you may need to use the CMD or Windows PowerShell tool to list drives. However, many people don’t know how to list drives in Command Prompt or PowerShell, like a user from the superuser forum:

Is there a way to list the available drives from cmd.exe? (Other than manually typing c: d: …) and seeing which ones return errors.https://superuser.com/questions/139899/see-available-drives-from-windows-cli

How to List Drives in CMD

Command Prompt, also known as CMD, is the command-line interpreter in Windows operating system. You can input certain commands in the Command Prompt window to take corresponding actions. If you want to list drives of your systems, you can use the WMIC (Windows Management Instrumentation for Management) or Diskpart command.

List Drives CMD via WMIC:

Step 1. Press Win + R keys to open the Run dialog box, and then type cmd in it and press Ctrl + Shift + Enter keys together to open the elevated Command Prompt window.

open Command Prompt window

Step 2. To let CMD list drives, type one of the following commands and hit Enter.

  • wmic logicaldisk get name
  • wmic logicaldisk get caption

list drives CMD

Step 3. If you want to display the Device ID and volume name, type the following command and hit Enter. Also, you can run the fsutil fsinfo drives command to list drives on your computer

wmic logicaldisk get deviceid, volumename, description

display device ID using CMD

List Drives CMD via Diskpart:

DiskPart is a disk partition management tool that uses command lines to perform operations. It can be used to list drives CMD as well. Here’s how to use it.

Step 1. Open the Command Prompt window again as we explained above.

Step 2. Type the following commands in order and hit Enter after each one. Then you will see a list of drives on the disk, including partition/volume number, label, letter, file system, size, and status.

  • diskpart
  • list disk
  • select disk *
  • list volume/list partition

list drives using diskpart in Command Prompt

How to List Drives in PowerShell

PowerShell is a command-line tool like CMD. Here you can let PowerShell list drives as well. To do so, follow the steps below:

Step 1. Open the Run dialog box, and then type powershell in it and hit Enter.

Step 2. In the Windows PowerShell window, type the following command and hit Enter.

get-psdrive -psprovider filesystem

PowerShell list drivers

How to let PowerShell/CMD list drive letters? Now, I believe that you already have known the answer.

Better Choice Than PowerShell/CMD List Drives

Although both of the two Windows tools can help you list drives, you may encounter some limitations to further managing drives/disks with them. For example, you can’t format a drive larger than 32GB to FAT32 using CMD. If you want to manage your hard disk or partitions more effectively, it’s highly recommended that you use a professional tool like MiniTool Partition Wizard.

MiniTool Partition Wizard DemoClick to Download100%Clean & Safe

It is a popular partition manager trusted by millions of users around the world. With this tool, you can not only obtain the drive information easily but do many other powerful tasks, including create/extend/move/format/wipe partition, convert NTFS to FAT32 without data loss, convert MBR to GPT, migrate OS, rebuild MBR, recover data, etc.

main features of MiniTool Partition Wizard

About The Author

Ariel

Position: Columnist

Ariel has been working as a highly professional computer-relevant technology editor at MiniTool for many years. She has a strong passion for researching all knowledge related to the computer’s disk, partition, and Windows OS. Up till now, she has finished thousands of articles covering a broad range of topics and helped lots of users fix various problems. She focuses on the fields of disk management, OS backup, and PDF editing and provides her readers with insightful and informative content.

I absolutely love the pure batch method shown in the answer from cybercontroler, all internal commands no less!

I wanted to share my batch edit/modification that based on cybercontroler’s answer.

For my current project, I needed to identify which drive labeled as DATA so I replaced the echo command with vol (internal command).

I also used the set command to create the variable [1] that would contain the full set of capital letters in order to shorten the for command’s length.

Since if exist will be checking for drive letters only, there will never be a space character in this test, so I omitted the double quotes.

Testing the omission the two back slashes yields the same results.

The added command line @echo off filtered the output to show results only.

I piped the results to the external find command to filter serial number lines created by the vol command.

I placed a pause command so that it wouldn’t be necessary to run a «Command Prompt» beforehand in order to see the results when clicking on the batch file.

The results from the original identified all available drive letters mixed in with for command processing the full set of capital letters. With @echo off filtering, my run displayed:

C:
D:

The results using vol displays:
Volume in drive C is OS

 Volume in drive D is DATA
Press any key to continue . . . 

Here’s my batch file which includes both for commands; you can comment-out the for command that you do not want to run by prefixing command lines with two colons (::).

Batch File

echo Available Drives:
for %%v in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%v:\\" 

echo %%-:
@echo off
set [1]=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
for %%- in (%[1]%) do if exist %%-: vol %%-: | find "in drive"
pause

Note that this batch method does not identify DVD drives, not sure why. But the command fsutil fsinfo drives does. My output reads: Drives: C:\ D;\ J:\ (J:\ being my DVD drive.)

Download Windows Speedup Tool to fix errors and make PC run faster

If you frequently work with the Command Prompt or PowerShell, you may need to copy files from or to an external drive, and many other times, you may need to display the drives within the console window. In this post, we will show you how you can list drives using Command Prompt or PowerShell in Windows 11/10/8/7.

If you need to simply list the drives, you may use WMIC.  Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems.

Open a command prompt, and type the following command:

wmic logicaldisk get name

Press Enter and you will see the list of Drives.

You can also use the following parameter:

wmic logicaldisk get caption

List Drives in Command Prompt 2

Using the following will display Device ID and volume name as well:

wmic logicaldisk get deviceid, volumename, description

Windows also includes an additional command-line tool for file, system and disk management, called Fsutil. This utility helps you list files, change the short name of a file, find files by SID’s (Security Identifier) and perform other complex tasks.  You can also use fsutil to display drives. Use the following command:

fsutil fsinfo drives

It will show mapped drives too.

You can also use diskpart to get a list of drives and more details. The  Diskpart utility can do everything the Disk Management console can do, and more! It’s invaluable for scriptwriters or anyone who prefers working at a command prompt.

Open CMD and type diskpart. Next, use the following command:

list volume

List Drives in Command Prompt

You will see that the console displays the Volume number and letter, label, formatting type, partition type, size, status, and other information.

List Hard Drives using PowerShell

To display drives using PowerShell, type powershell in the same CMD windows and hit Enter. This will open a PowerShell window.

Now use the following command:

get-psdrive -psprovider filesystem

List Drives in powershell

I hope this helps.

Now see how you can get a list of all Device Drivers using Command Prompt and how to use PowerShell to get physical Disk information.

Anand Khanse is the Admin of TheWindowsClub.com, a 10-year Microsoft MVP (2006-16) & a Windows Insider MVP (2016-2022). Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.

List all drives command line: on Windows

neotam Avatar


List all drives command line: on Windows

Posted on :

There are different commands available to view list of drive on Windows but you need administrator privileges

  • wmic
  • fsutil
  • diskpart
  • Using PowerShell

Storage is organised as Disks, Partitions, Volumes and Virtual Disks, Where

  • Disk is the physical storage device either HDD or SSD attached to the computer
  • Partition is the region or logical section on the secondary storage that is managed separately
  • A volume is the storage container on a file system. Comparing volume with partition, volume is single accessible storage area with a single file system while a partition is logical subdivision of a storage (HDD)
  • Virtual hard disks (VHDs) are virtual hard disk files that are mounted, and operated much identical to physical hard drives but differences is that they are typically used by Hyper-V virtual machines.

This article provides different set of commands that can be used to list Disks, partitions, and Volumes on Windows

Open the powershell or command prompt with admin privileges

Using Wmic Command

type the following

wmic 
diskdrive get 

List the volume drive letters using wmic

wmic logicaldisk get name 

get verbose output using wmic command with command line arguments as follows

wmic logicaldisk get deviceid, volumename, description

or,

wmic logicaldisk get caption 

Using FsUtil

List drive information using “fsutil”

fsutil fsinfo drives 

Using Diskpart Command

Or, we can use the diskpart

Open the command prompt or power shell with admin privileges, then go ahead with following commands

diskpart 

To list the disks

list disk 

To list volumes

list volume 

List the partition, but you need to select the one of the disk using disk number

list disk using command “list disk”


DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Errors          931 GB  2048 KB   *    *
  Disk 1    Online          476 GB  2048 KB        *

 

For suppose select the disk 0 and list partitions

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list partition

  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Dynamic Reserved  1024 KB  1024 KB
  Partition 2    Reserved           127 MB  2048 KB
  Partition 3    Dynamic Data       931 GB   129 MB

make sure appropriate disk is selected to check partitions on selected disk using command “list partition” .

List Drives using PowerShell

Use the following command to list drives using Windows PowerShell

List the drives using “PowerShell” using “get-psdrive” command

get-psdrive -psprovider filesystem 

get-volume command on PowerShell gives the output of volumes on computer

get-volume 

Command mountvol

Command mountvol can be used to create, delete or list a volume mount points

List drives and mount points using command mountvol

mountvol 

Windows operating system has this concept of hard drives,
which are storage memory of the operating system. Windows operating system may
have one or more hard drives, external hard drives, virtual hard drives and so
on. As a user, you may need to list all the hard drives of your PC. One process
of accomplishing it is the use of Windows Management Instrumentation. Other
than this, you can also use Command Prompt or Windows Powershell to find out
the list of hard drives. In this article, I shall show you the commands you can
use on Command Prompt, to list all hard drives. Have a look!

Open Windows Search menu. Type Command Prompt, and Command Prompt application will appear in the search result. Right click on it and click on Run as Administrator. This will open the elevated command prompt.

Get A List Of Device Drivers In Windows 10 Using Command Prompt

To check the list of hard drives on your PC, type or copy and paste the following command and hit Enter.

 wmic logicaldisk get name 

How To List Hard Drives using Command Prompt in Windows 10

You can also try the following command. Copy and paste it and hit Enter to execute the command.

 wmic logicaldisk get caption 

How To List Hard Drives using Command Prompt in Windows 10

Check the following command. It displays the Device ID, volume name and description of the drive, if available.

 wmic logicaldisk get deviceid, volumename, description 

How To List Hard Drives using Command Prompt in Windows 10

There is another type of command line tool called Fsutil. The purpose of this command line tool is to find the list of files, change the name of a file, search files by Security Identifier, etc. Copy and paste the command and click OK. Check out how the command works.

 fsutil fsinfo drives 

How To List Hard Drives using Command Prompt in Windows 10

For listing hard drives, diskpart command can also be used by deploying the disk management console. As of now, the above commands are sufficient.

  • Windows cmd copy file to directory
  • Windows cmd remove all files
  • Windows cannot verify the digital signature for this file 0xc0000428 windows 7
  • Windows cmd check windows version
  • Windows cmd shell quoting issues