Updated by

Linda

Last updated on April 22, 2024

Want to learn how to list drives in Command Prompt (CMD) and PowerShell? This guide from /Tools will show you two methods: using the built-in command-line tool CMD and PowerShell.

Command Prompt and PowerShell are powerful interfaces in Windows. While Command Prompt has long been used for running commands, PowerShell offers advanced features. Both tools allow users to interact with the system through text-based commands, making tasks more efficient.

Warning
Be careful when working on the command line. Mistyped or incorrect commands can have unintended consequences. If you're unsure about a command, research it further before proceeding. Also, always back up critical data before making system changes.

Command to list drives

There are two primary methods to list drives in the Command Prompt (CMD): Diskpart and WMIC. Let's learn how to list drives via CMD.

#1. Diskpart

Diskpart is a powerful command-line tool specifically designed for managing disk drives and partitions. Here's how you'd use it to list your drives in American English: 1. Press the Windows key + X on your keyboard. 2. Click on "Command Prompt (Admin)" or "Windows PowerShell (Admin)" to open an elevated command prompt. 3. Type "diskpart" and press Enter. This will launch the Diskpart utility. 4. Inside Diskpart, type "list disk" and press Enter. This will display a list of all the disks connected to your system. That's it! You'll see the disks numbered along with some basic information like size and status.

Step 1: Open the Command Prompt. Type CMD in the Windows search bar and then hit Enter to open it.

Open the Windows Command Prompt

Step 2: At the command prompt, enter each of the following commands one by one, and press "Enter" after each command:

diskpart
list disk
select disk X (replace "X" with the disk number)
list volume OR list partition

Enter List Volumes

Here, you can see the list of drives on the disk, including Partition/Volume number, Label, Drive letter, File system, Size, and Status. After listing the drives with Diskpart, you can perform more operations using this utility:

Please provide the English content you'd like translated, I'll do my best to translate it into Chinese for you.

#2. Windows Management Instrumentation Command-line (WMIC)

WMIC (Windows Management Instrumentation Command-line) is a versatile tool that allows you to query various system components, including hard drives. Here's how to use WMIC to list your drives:

Step 1: Open the Command Prompt and type one of the following commands, then press Enter.

Query logical disk names using WMIC
Query logical disk labels using WMIC

wmic-logicaldisk-get-name

Step 2: To view the device ID and volume name, type the following command and press "Enter." Alternatively, you can use the fsutil fsinfo drives command to list the drives on your computer.

Use the wmic command to query the device ID, volume name, and description of logical disks

wmic logicaldisk get deviceid, volumename, description

List Drives with PowerShell

Let's switch gears and see how another powerful command-line tool, PowerShell, can list drives. PowerShell provides a more modern, object-oriented approach to system administration than CMD. Here's how you can list drives with PowerShell:

Step 1: Search for “PowerShell” in the Windows search bar, then click on it to open.

Open the Windows PowerShell window

Step 2: Type the following command, and then press Enter.

Get-PSDrive -PSProvider FileSystem

Get-psdrive-psprovider-filesystem

Was the information in this article helpful to you? Feel free to share it with others.

"nbsp;" 在中文中通常表示为 "空格"。它是英文中的一个转义字符,用于在HTML或XML等标记语言中插入不可见的空格。

A better disk picker than CMD/Powershell

If you're looking for a simpler alternative to the command line complexity of Command Prompt and PowerShell, consider using a tool like Partition Master Professional for smooth disk management. Its user-friendly interface makes it easy to manage your drives.

epm-main-interface

Here are some of its virtues:

    • Convert FAT32 to NTFS without losing data.
    • Support NTFS, FAT32, exFAT, and EXT2/3/4 file system formats.
    • Extend partitions easily with non-contiguous unallocated space.
    • Safely wipe entire disks to prevent data recovery.
    • Migrate the Windows system to a new HDD/SSD seamlessly. Learn more.
    • Switch between GPT and MBR disk styles without data loss.

So why bother with complicated command line interfaces when you can manage your disks with ease using tools like Partition Master? Download this powerful tool now and experience its convenience and efficiency for yourself.

Conclusions

This guide explores two methods of listing drives in Windows: the tried-and-true Command Prompt (CMD) with its diskpart and WMIC utilities, as well as the more modern PowerShell. While both offer powerful tools, the arcane commands they employ might be an obstacle for some users to understand and use.

"Partition Master streamlines disk management with a clean graphical interface, sparing you the need to decipher complex syntax! The software not only lets you view your drives but also perform various tasks such as formatting, extending partitions, migrating operating systems, and even securely wiping disks."

Don't forget to share your knowledge with others!

The Chinese translation of "空格" is "space" in American English.

"Frequently Asked Questions on Listing Drives in Command Prompt and PowerShell with UTF-8 encoding"

Need help listing drives in Command Prompt or PowerShell? Follow this FAQ.

How do I get a list of all drives in CMD?

There are two primary ways to list all drives in CMD, and both methods assume that you're running the Command Prompt as an administrator:

  • Use Diskpart: This utility provides an extensive view, including details like disk size and partition style. Follow the steps in the "CMD List Drives" section above to use Diskpart to list your drives.
  • Use WMIC: This versatile tool can provide information about logical disks (partitions with drive letters). The command wmic logicaldisk get name or wmic logicaldisk get caption will display a list of drive letters associated with your partitions.

2. How do I get disk information from CMD?

You can use diskpart via CMD to obtain disk information:

    • Open the Command Prompt and enter each of the following commands, pressing "Enter" after each one: • Type: `diskpart` • Type: `list disk` • Type: `select disk (insert disk number)` • Type: `list volume` or `list partition`

3. Is PowerShell the same as CMD?

No, CMD is the classic text-based command prompt, while PowerShell is a newer, more object-oriented system administration tool.