Список дисков через командную строку windows 10

  • 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

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.

To list all disks in Command Prompt (cmd), you can use the Diskpart utility followed by the ‘list disk’ command. Here’s how to do it:

diskpart
list disk

Understanding CMD Commands

What is CMD?

The Command Prompt (CMD) is a powerful tool in Windows that allows users to execute commands to perform advanced administrative tasks, troubleshoot issues, and configure system settings. It offers a text-based interface, enabling users to communicate directly with their operating system.

Using CMD is crucial for anyone looking to manage their computer efficiently, as it can speed up tasks that may take longer through the graphical interface. For advanced users, it encompasses a myriad of functions, including file management, network configuration, and disk management.

The Role of Disk Management in CMD

Disk management is a vital aspect of maintaining a healthy computer system. It involves overseeing and configuring storage devices like hard drives and solid-state drives while ensuring they function correctly. With CMD, you can easily manage your disks, including formatting, partitioning, and listing disks connected to your machine.

Mastering The List Disk Cmd Command In Minutes

Mastering The List Disk Cmd Command In Minutes

Listing Disks in CMD

What Does «List Disks» Mean?

To list disks refers to checking the disks that are currently connected to your computer. This capability is particularly helpful for system administrators and advanced users who need to monitor disk usage, check disk status, and manage disk partitions. Knowing the disks connected helps you identify storage limitations or potential issues that may impact your system’s performance.

How to Access Command Prompt

Accessing Command Prompt is the first step to listing disks. Here’s how you can do it:

  • Using Windows Search: Type “cmd” or “Command Prompt” in the Windows search bar. Click on it to open.
  • Accessing through the Run Dialog: Press `Windows + R`, type `cmd`, and hit Enter.
  • Opening CMD as an Administrator: Right-click on the Command Prompt icon in the search results and select “Run as administrator” for full privileges.

List Disk Cmd Windows: Quick Guide to Disks Management

List Disk Cmd Windows: Quick Guide to Disks Management

Using the Diskpart Command

Introduction to Diskpart

Diskpart is a built-in Windows utility for disk management. It provides more comprehensive features than the standard graphical interface and allows users to manage disks, partitions, and volumes directly through commands. The command-line environment of Diskpart is especially beneficial when dealing with multiple disks or when you encounter issues that require a more hands-on approach.

Command to List Disks

To list disks in CMD, you can use the Diskpart utility. Here’s how you can do it:

  1. Open Command Prompt as an Administrator.
  2. Launch Diskpart by typing the following command:
diskpart
  1. Once in the Diskpart environment, type the next command to list all disks:
list disk

Example of Listing Disks

After executing the `list disk` command, you will see an output that resembles the following structure:

Disk ###  Status         Size     Free     Dyn  Gpt
--------  -------------  -------  -------  ---  ---
Disk 0    Online         476 GB   50 GB        *
Disk 1    Online         931 GB   0 B

In this output:

  • Disk Number: Identifies the individual disk (e.g., Disk 0, Disk 1).
  • Status: Indicates whether the disk is online or offline.
  • Size: Displays the total capacity of the disk.
  • Free Space: Shows the amount of unallocated space available.
  • Dynamic/Basic: Designates the type of disk configuration (if applicable).

List Users in Cmd: A Quick Guide for Beginners

List Users in Cmd: A Quick Guide for Beginners

Additional Disk Management Commands

Show Additional Disk Information

Once you have listed the disks, you might want to retrieve more detail about a specific disk. This can be done using two commands in Diskpart:

select disk [number]
detail disk

For example, if you want to see details of Disk 0, you would execute:

diskpart
select disk 0
detail disk

This will provide comprehensive information about the selected disk, including its partitions, serial number, and more.

Exploring Diskpart Further

In addition to `list disk`, Diskpart includes numerous commands for advanced disk management:

  • `list volume`: Displays all available volumes.
  • `list partition`: Shows partitions on the selected disk.
  • `create partition primary`: Creates a new primary partition.

Understanding these commands allows you to manage your disk configuration extensively.

List Files Cmd Windows: A Simple Guide

List Files Cmd Windows: A Simple Guide

Listing Disk Drives in CMD

Using WMIC to List Disk Drives

An alternative to Diskpart for listing disks is using WMIC (Windows Management Instrumentation Command-line). This command can be executed directly in CMD, providing a concise overview of disk drives:

wmic diskdrive list brief

Running this command will produce an output similar to the one below, which highlights the manufacturer and size of each disk:

DeviceID     Model                          Size
-----------  --------------------------     --------
\\.\PHYSICAL0  Samsung SSD 970 EVO 500GB     500107862016
\\.\PHYSICAL1  Seagate HDD 1TB               1000204886016

Advantages of Using WMIC

WMIC can be advantageous for users who prefer a simpler and more straightforward syntax. Its output is often easier to interpret for users who aren’t accustomed to more complex command-line structures found in Diskpart. Additionally, it can provide quick insights without needing to navigate through Diskpart’s menus.

List Folders in Cmd: A Quick Guide to Navigation

List Folders in Cmd: A Quick Guide to Navigation

Troubleshooting Common Issues

Common Mistakes When Listing Disks

While executing commands to list disks in CMD, some common errors include:

  • Incorrect command usage: Ensure there are no typographical errors in your commands.
  • Lack of administrator privileges: Always run CMD as an Administrator when executing Diskpart or other system-level commands.

Resolving Errors in CMD

If you encounter issues, you can troubleshoot as follows:

  • Restart CMD as Administrator: If you didn’t run CMD as Administrator, exit and relaunch it with elevated privileges.
  • Check Disk Connections: Ensure that the disks are properly connected to your system.
  • Use the `diskpart` command: If you’re unsure, retype `diskpart` to ensure are in the right environment to start executing Diskpart commands.

How to List Drives in Cmd: A Quick Guide

How to List Drives in Cmd: A Quick Guide

Conclusion

Summary of Key Points

In this guide, you’ve learned how to list disks in CMD using various methods, including the Diskpart and WMIC commands. Understanding how to monitor and manage disks is crucial for effective system management.

Next Steps for CMD Enthusiasts

I encourage you to practice using CMD commands regularly. Explore other commands, such as those for managing files, network settings, and user accounts. The more you familiarize yourself with these utilities, the more adept you will become at troubleshooting and configuring your system.

Mastering Strings Cmd: A Quick Guide to String Manipulation

Mastering Strings Cmd: A Quick Guide to String Manipulation

Call To Action

Join Our Community

Interested in learning more about CMD commands? Join our community to receive updates, tips, and resources geared towards mastering CMD and enhancing your technical skills.

Feedback Request

We would love to hear from you! Share your experiences or suggest topics for our future posts to help us provide the best content for you.

Windows comes with a built tool— Disk Management —that offers a complete solution to manage hard disks on the computer. You can use it to shrink volume, increase volume or portion size, create new ones, and so on. The user interface is built using a set of commands— DISKPART — that works on PowerShell or Command Prompt. It comes in handy when you need to run complex commands and work with the virtual hard disk. Diskpart utility has a list of commands that one can use that are shared in the post.

List of Diskpart Commands

active Marks the disk’s partition with focus as active.
add Mirrors the simple volume with focus to the specified disk.
assign Assigns a drive letter or mount point to the volume with focus.
attach vdisk Attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive.
attributes Displays or sets or clears the attributes of a disk or volume.
automount Enables or disables the automount feature.
break Breaks the mirrored volume with focus into two simple volumes.
clean Removes any and all partition or volume formatting from the disk with focus.
compact vdisk Reduces the physical size of a dynamically expanding virtual hard disk (VHD) file.
convert Converts file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and directories intact.
create Creates a partition on a disk, a volume on one or more disks, or a virtual hard disk (VHD).
delete Deletes a partition or a volume.
detach vdisk Stops the selected virtual hard disk (VHD) from appearing as a local hard disk drive on the host computer.
detail Displays information about the selected disk, partition, volume, or virtual hard disk (VHD).
exit Exits the diskpart command interpreter.
expand vdisk Expands a virtual hard disk (VHD) to the size that you specify.
extend Extends the volume or partition with focus, along with its file system, into free (unallocated) space on a disk.
filesystems Displays information about the current file system of the volume with focus and lists the file systems that are supported for formatting the volume.
format Formats a disk to accept Windows files.
gpt Assigns the gpt attribute(s) to the partition with focus on basic GUID partition table (gpt) disks.
help Displays a list of the available commands or detailed help information on a specified command.
import Imports a foreign disk group into the disk group of the local computer.
inactive Marks the system partition or boot partition with focus as inactive on basic master boot record (MBR) disks.
list Displays a list of disks, of partitions in a disk, of volumes in a disk, or of virtual hard disks (VHDs).
merge vdisk Merges a differencing virtual hard disk (VHD) with its corresponding parent VHD.
offline Takes an online disk or volume to the offline state.
online Takes an offline disk or volume to the online state.
recover Refreshes the state of all disks in a disk group, attempts to recover disks in an invalid disk group, and resynchronizes mirrored volumes and RAID-5 volumes that have stale data.
rem Provides a way to add comments to a script.
remove Removes a drive letter or mount point from a volume.
repair Repairs the RAID-5 volume with focus by replacing the failed disk region with the specified dynamic disk.
rescan Locates new disks that may have been added to the computer.
retain Prepares an existing dynamic simple volume to be used as a boot or system volume.
san Displays or sets the storage area network (san) policy for the operating system.
select Shifts the focus to a disk, partition, volume, or virtual hard disk (VHD).
set id Changes the partition type field for the partition with focus.
shrink Reduces the size of the selected volume by the amount you specify.
uniqueid Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature for the disk with focus.

TIP: You can resize a Partition even if Disk Management fails using DISKPART and FSUTIL command-line tools for Disk Management.

How to use Diskpart command in Windows 11/10?

Diskpart Commands

Diskpart runs in its own space, so when you run the command, you will not be able to use the regular commands but only the Diskpart commands.

  • Type CMD in the Start screen, and choose to Run as Administrator
  • Type Diskpart, and press the Enter key.
  • You should see the console to switch from regular Windows path to Diskpart
  • Post this; you can start with few basic commands to understand how it works.

Note: Be aware if you choose to delete anything, it cannot be recovered.

Few Basic Commands to Start With Diskpart

  • List Disk:  Displays number of connected hard drives or storage
  • Select Disk <no> : Selects the particular disk
  • List Partition: Displays list of partitions for the selected disk
  • List Volume: Displays all the partitions of all the disks

How to open DiskPart in Windows?

Open Command Prompt with admin privileges, type Diskpart, and press the Enter key. You can also launch Diskaprt using the Run prompt. Make sure to press Shift + Enter to launch it with admin privileges.

Related: Fix There are no fixed disks to show.

How Do I List Drives in Diskpart?

Once you are inside Diskpart, type List Disk, this will list down all the connected storage, including hard drives, USB storage, SD card, or anything else connected to the PC.

Related: How to undo DISKPART Clean command

How Do I Delete a Volume or Partition?

  • Select Disk <no>
  • List Volume
  • Select Volume <no>
  • Delete Volume

Post this; a confirmation message will show up that Diskpart has successfully deleted the volume. That said, you cannot delete System or Boot Volume. If you are unable to delete it, make sure to read this guide.

How Do I Assign Drive Letter to a Hidden Partition?

If a partition can be seen in the Diskpart tool but is not available through the File Explorer, then it’s because there is no drive letter assigned to it.

  • Select Disk <no>
  • List Volume
  • Select Volume <no>
  • assign letter=<alphabet>

Make sure that the assigned alphabet is not already in use.

Related: There is not enough space available on the disk(s) to complete this operation.

How to Reduce the Size of a partition?

Before we move ahead, be aware that this is a very long process. Until the process is complete, the drive will be almost useless.

  • Select Disk <no>
  • List Volume
  • shrink desired=<no>

This works for the NTFS file system only.

Read: Fix Diskpart failed to clear disk attributes.

How to Erase a Disk using Diskpart Clean Command?

  • Open Diskpart command in the Command Prompt
  • Type list disk and press Enter
  • Select the Disk you want to clean using select disk <no>
  • Type clean, and press the Enter key

Make sure not to use the clean all command; it will remove all partitions of the selected disk. Also, it will take an hour or so, depending on the disk size, as it will perform a secure erase.

Related: DiskPart has encountered an error: Access is denied.

Free Alternatives to Windows Diskpart Utility

These are third-party software that offers a better interface and features compared to Diskpart. In fact, you get to see a preview of the change before the change is committed. Here is a quick list:

  • Paragon Partition Manager Free Edition
  • Macrorit Disk Partition Expert
  • More Disk & Partition Manager software for Windows

I hope you were able to understand how to use it, the list of commands Diskpart houses, and alternatives to Windows Diskpart software that you can use for a better experience.

This guide explains how to use the diskpart utility for the following Windows versions: Windows XP, Vista, 7, 8, 8.1 or 10.

What is diskpart

The diskpart utility (available in Windows 2000, XP, Vista, 7, 8, 8.1 and 10) can be used to create or delete partitions on your PC.

Command Prompt: list disk

Command Prompt: list disk

The utility allows you to:

  • Partion
  • Remove partitions
  • Remove formatting
  • Assign and remove drive letters and mount points
  • Convert disks from basic to dynamic
  • Create and extend volumes

Most commands that you can perform in Disk Management (see Boot partitions) are available with diskpart. Because it’s a command line utility, you need to open Command Prompt and type diskpart.

On Windows Vista, 7, 8 and 10 systems, you can type diskpart at Run, click OK or press Enter and Command Prompt will automatically open with diskpart loaded.

When the utility is loaded, you will notice the version installed on your computer:

Microsoft DiskPart version 6.1.7600
Copyright  1999-2008 Microsoft Corporation.
On Computer: MY_COMPUTER

Commands and parameters

The diskpart tool has the following commands and parameters available:

  • select can set the focus on a specific target
  • select disk – use this command to set the focus on a specific disk

    Command Prompt: select disk

    Command Prompt: select disk

  • select partition – use the select partition command to set the focus on a specific partition
  • select volume – use this command to set the focus on a specific volume
  • detail disk will deliver information about the current disk
  • detail partition will deliver information about the current partition
  • detail volume will deliver information about the current volume
  • list disk – use list disk to get summary information about the available disks on your computer
  • list partition – use this command to get information about each partition available on a specific disk
  • list volume – use list volume to get information about each volume available on the computer
  • active – use the active command to set the focus on the current partition to be active
  • assign – use assign to assign a letter or a mount point to the current active partition
  • create partition primary size=SIZE_IN_MB – use this command to create a new primary partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • create partition extended size=SIZE_IN_MB – use this command to create a new extended partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • create partition logical size=SIZE_IN_MB – use this command to create a new logical partition. The SIZE_IN_MB is the size of the partition you want to create, in MB.
  • delete partition will delete the current active partition
  • extend will extend the current volume
  • remove will remove a letter or a mount point from the current active partition
  • active – use this to set the current volume as active
  • add disk – use this command to add a mirror to the current active volume
  • break disk – use this command to break the mirror added
  • create volume stripe – use this to create a stripe set volume on a specified disk
  • create volume raid – use this command to create a Raid-5 volume on a specified disk
  • delete disk – use this command to delete a missing dynamic disk
  • delete partition – use this command to delete the current active partition
  • extend disk – use this command to extend the current volume
  • import can be used to import disks from a foreigh disk group
  • online can be used to bring a disk or a volume online that was previously offline
  • remove can be used to remove a letter or a mount point from the current active volume
  • retain is used to prepare a volume to be used as a boot or system volume
  • convert mbr will set the partition style of the current disk to MBR
  • convert gpt will set the partition style to GPT
  • convert dynamic will change a basic disk into a dynamic one
  • convert basic will convert a dynamic disk (empty disk) into a basic disk
  • exit will exit the utility
  • clean will remove the partition or volume formatting from the current disk
  • rescan can rescann the I/O buses and can discover new disks added to the computer
  • help will display the list of all available commands

Error Codes

You can find a list error codes to debug various errors:

  • Code 0 means that no errors occurred
  • Code 1 means that a fatal exception occurred
  • Code 2 means that the parameters you specified for a command are incorrect
  • Code 3 means that diskpart is unable to open the specified file
  • Code 4 means that diskpart (one of the services used by the utility) returned a failure
  • Code 5 means a command syntax error

diskpart in Windows XP

Note that the fdisk utility found in pre-Windows XP systems is now known as diskpart on Windows XP systems.

If you can boot into Windows XP

If you can boot into your computer, you simply need to open Command Prompt to access diskpart:

  1. Boot into Windows XP
  2. Click Start
  3. Click Run
  4. Type cmd
  5. Press Enter or click OK
  6. At the Command Prompt window, type diskpart
  7. Press Enter

If you can’t boot into Windows XP

If you can’t boot into Windows XP to access diskpart, you have 2 options:

  • Use the original CD to access Recovery Console
  • Use Easy Recovery Essentials to launch Command Line

If you have the original CD:

If you can’t boot into Windows XP, but you have the original CD, you can access the Recovery Console:

  1. Insert the Windows XP CD
  2. Reboot the computer
  3. Press any key to boot from the CD
  4. At the Microsoft Setup menu, press R
  5. Select the operating system and enter the Administrator password, if requested
  6. When Command Line appears, type diskpart
  7. Press Enter

If you use Easy Recovery Essentials:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows Vista

You need to run these steps as an Administrator on Windows Vista systems.

If you can boot into Windows Vista with no errors, follow the If you can boot into Windows Vista set of instructions. Otherwise, follow If you can’t boot into Windows Vista.

If you can boot into Windows Vista

You simply need to open Command Prompt, if you can boot into Windows Vista:

  1. Boot into Windows Vista
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. You may need to right-click Command Prompt > Run as Administrator, if you are not logged in as Administrator already
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows Vista

If you can’t boot into your system, you have the following options:

  • Use the installation disc to access System Recovery Options
  • Access System Recovery Options without the installation disc (if installed)
  • Use Easy Recovery Essentials and access Command Line

If you have the installation disc:

If you can’t boot into Windows Vista, but you have the Windows Vista disc, follow these steps to open diskpart:

  1. Insert the original CD/DVD in the optical drive
  2. Boot your computer
  3. Press any key to boot from the CD/DVD
  4. Select your language, time and keyboard
  5. Click Next
  6. Click Repair your computer
  7. Select the operating system
  8. Click Next
  9. When the System Recovery Options screen appears, click Command Prompt
  10. Type diskpart:
    diskpart
  11. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If your Windows Vista has the System Recovery Options installed and is available at the Advanced Boot Options menu, you can run Command Prompt from there. Otherwise, see the “If you use Easy Recovery Essentials” set of instructions below.

Follow these steps below to access diskpart without the installation disc:

    1. Reboot the computer
    2. Press F8 as your computer starts to boot, but before the Windows Vista logo appears
    3. Select Repair Your Computer, at the Advanced Boot Options menu

If a “Repair Your Computer” option isn’t listed, System Recovery Options is not installed on your computer. Use the original installation disc or go to the “If you use Easy Recovery Essentials”set of instructions below .

Repair Your Computer in Advanced Boot Options

  • Select Command Prompt at the System Recovery Options menu
  • Type diskpart
  • Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

If you don’t have the installation disc available, can’t boot into Windows Vista or you don’t have the “Repair Your Computer” option listed at the Advanced Boot Options menu, you can use Easy Recovery Essentials to access Command Prompt and load diskpart.

Follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 7

On Windows 7 systems, you can access diskpart just as you do Windows Vista systems.

Note that you need to run these steps as an Administrator on Windows 7 computers.

If you can boot into Windows 7

If you can boot into your Windows 7 system, simply open Command Prompt:

  1. Boot into Windows 7
  2. Click Start
  3. Type cmd
  4. Click Command Prompt from the search results list. Right-click on Command Prompt > Run as Administrator.
  5. When Command Prompt loads, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 7

Similar to Windows Vista, if you can’t boot into your system, you have the following options:

  • Use the installation disc
  • Boot into the Advanced Boot Options menu to access System Recovery Options
  • Use Easy Recovery Essentials and access Command Line

If you have the installation disc:

If you can’t boot into Windows 7, but you have the installation disc, you can run diskpart using the disc. To do so, follow these steps:

    1. Insert the disc in the optical drive of your computer
    2. Restart the computer
    3. Press any key to boot from the disc
    4. Select your preferred language, time and keyboard
    5. Click Next
    6. Click Repair your computer at the Install Windows screen
      Install Windows 7 Screen

    7. Select the operating system from the list
    8. Click Next
    9. Select Command Prompt
      Windows 7 System Recovery Options

    10. Type diskpart
diskpart
  1. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

Usually, Windows 7 systems should have the System Recovery Options installed on the hard drive. If it’s not (follow steps below), go to the “If you use Easy Recovery Essentials” set of instructions below for an alternative to access diskpart.

Follow these steps to access diskpart without an installation disc on a Windows 7:

  1. Restart the computer
  2. Press F8 as the computer starts to boot. Press F8 before the Windows 7 logo appears.
  3. Select Repair Your Computer at the Advanced Boot Options screen

    If Repair Your Computer is not listed, System Recovery Options is not installed on your PC. Go to If you use Easy Recovery Essentials for an alternative.

    Windows 7 Advanced Boot Options

  4. Press Enter
  5. Select Command Prompt
    Windows 7 System Recovery Options

  6. Type diskpart
  7. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 8

If you can boot into Windows 8

If you can boot into your Windows 8 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

  1. Boot into Windows 8
  2. Press the key and C to open the charm bar
  3. Type cmd
  4. Click Command Prompt
  5. When Command Prompt opens, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 8

If you can’t boot into your Windows 8, you have these options available:

  • Use the original DVD or USB with Windows 8 or Windows 8.1 to access the Repair your computer option
  • Boot into the System Recovery Options with Shift and F8
  • Use Easy Recovery Essentials to launch Command Line

If you have the installation disc:

If you can’t boot, but you have the installation disc, follow these steps:

  1. Insert the Windows 8 DVD or 8.1 USB
  2. Restart the computer
  3. Press any key to boot from the media
  4. Click Repair your computer or press R
    Windows 8 Repair your computer

  5. Select Troubleshoot
  6. Select Command Prompt
  7. Type diskpart
  8. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If you don’t have the installation disc, you can boot into System Recovery Options or use Easy Recovery Essentials.

To access diskpart without an official Windows 8 or Windows 8.1 disc, follow these steps:

  1. Reboot the system
  2. Press Shift and F8 very quickly
  3. At Choose an option, select Troubleshoot
    Choose an option in Windows 8

  4. Select Command Prompt
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

diskpart in Windows 10

If you can boot into Windows 10

If you can boot into your Windows 10 system, you simply need to open Command Prompt to access diskpart. To do so, follow these steps:

  1. Boot into Windows 10
  2. Press the key and C to open the charm bar
  3. Type cmd
  4. Click Command Prompt
  5. When Command Prompt opens, type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you can’t boot into Windows 10

If you can’t boot into your Windows 10, you have these options available:

  • Use the original DVD or USB with Windows 10 to access the Repair your computer option
  • Boot into the System Recovery Options with Shift and F8
  • Use Easy Recovery Essentials to launch Command Line

If you have the installation disc:

If you can’t boot, but you have the installation disc, follow these steps:

  1. Insert the Windows 10 or USB
  2. Restart the computer
  3. Press any key to boot from the media
  4. Click Repair your computer or press R
    Windows 10 setup screen

  5. Select Troubleshoot
  6. Select Command Prompt
  7. Type diskpart
  8. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you don’t have the installation disc:

If you don’t have the installation disc, you can boot into System Recovery Options or use Easy Recovery Essentials.

To access diskpart without an official Windows 10 media, follow these steps:

  1. Reboot the system
  2. Press Shift and F8 very quickly
  3. At Choose an option, select Troubleshoot
    win10_advanced_options

  4. Select Command Prompt
  5. Type diskpart
  6. Press Enter

For the full list of diskpart commands and paremeters, go to Commands and Parameters.

If you use Easy Recovery Essentials:

Easy Recovery Essentials can run from any CD, DVD or USB flash drives.

To access diskpart using Easy Recovery Essentials, follow these steps:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

Troubleshooting

Download diskpart

You can not download diskpart utility. This utility is a command line utility part of Windows.

To access diskpart, you have the following options:

  • Use the original CD/DVD or USB of your Windows to access Recovery Console (for Windows XP) or System Recovery Options (for Windows Vista-8)
  • Boot into the recovery mode of your Windows
  • Use Easy Recovery Essentials, our recovery and repair disk, and open Command Line to access diskpart

Instructions on how to access diskpart if you use Easy Recovery Essentials:

  1. Download Easy Recovery Essentials
  2. Burn the ISO Image. Follow our instructions on how to burn a bootable ISO image. If you’d like to have a recovery USB instead, follow our instructions on how to make a recovery USB.
  3. Boot Easy Recovery Essentials from the CD, DVD or USB
  4. Select Launch Command Line

Instructions on how to access diskpart if you have the installation disc:

  • For Windows XP
  • For Windows Vista
  • For Windows 7
  • For Windows 8 or Windows 8.1
  • For Windows 10

Instructions on how to access diskpart if you don’t have the installation disc:

  • For Windows XP
  • For Windows Vista
  • For Windows 7
  • For Windows 8 or Windows 8.1
  • For Windows 10

Format USB with diskpart

To format a USB flash drive with diskpart, follow these steps:

  1. Open the utility by typing diskpart in Command Prompt
  2. Press Enter
  3. Once loaded, type list disk:
    list disk
  4. Press Enter
  5. Determine which of the disks listed is your USB flash drive, e.g. Disk 2.
  6. Type select disk 2, if #2 is the USB flash drive presented by the list disk command
  7. Press Enter
  8. Type clean to clean the USB flash drive:
    clean
  9. Press Enter
  10. Type this command:
    create partition primary
  11. Press Enter
  12. Type active:
    active
  13. Press Enter
  14. You should now receive this confirmation message:
    DiskPart marked the current partition as active.
  15. Type this command to format the USB flash drive:
    format fs=ntfs label="MY USB DRIVE"

    where ntfs is the NTFS file system (you can also use fs=fat32) and “MY USB DRIVE” is the label given to the USB drive.

  16. Type assign:
    assign
  17. Press Enter
  18. Quit diskpart by typing exit:
    exit
  19. Press Enter

Bootable USB with diskpart

To create a bootable USB using diskpart, follow the steps from Format USB with diskpart.

Once successfully formatted the drive, simply copy the files to the USB drive.

USB not showing in diskpart

diskpart will not list external media, e.g. USB flash drive, if you’re using Windows XP.

Windows Vista to Windows 8 systems will show the USB flash drives in diskpart.

More Information

Support Links

  • Easy Recovery Essentials for Windows – our repair and recovery disk.

    It’s an easy-to-use and automated diagnostics disk. It’s available for Windows 8, Windows 7 and Windows Vista. It’s also available for Windows XP and Windows Server.

    Read more at Windows Recovery Disks.

  • The NeoSmart Support Forums, member-to-member technical support and troubleshooting.
  • Get a discounted price on replacement setup and installation discs: Windows XP, Windows Vista, Windows 7, Windows 8, Windows 10.

Applicable Systems

This Windows-related knowledgebase article applies to the following operating systems:

  • Windows XP (all editions)
  • Windows Vista (all editions)
  • Windows 7 (all editions)
  • Windows 8 (all editions)
  • Windows 8.1 (all editions)
  • Windows 10 (all editions)
  • Windows Server 2003 (all editions)
  • Windows Server 2008 (all editions)
  • Windows Server 2012 (all editions)

Propose an edit

Sometimes the disk on your Windows 10 system may not work correctly, or the Windows fails to start because of the hard disk error. To rectify such disk errors, Windows 10 comes with an excellent tool known as DiskPart.

The DiskPart is a powerful command tool that lets you manage the Windows disks and partitions using Command Prompt or Windows PowerShell. This command interpreter allows you to delete, create, and modify partitions on any drives your PC can detect, even the external hard drives and USB storage. It is quite useful when any Pendrive or hard disks get corrupted because of logical errors and stopped working. Using DiskPart commands, you can wipe out the data and start clean.

To fix various Windows 10/11 problems, we recommend Outbyte PC Repair:
This software will repair common computer errors, protect you from file loss, malware damage, hardware failure, and optimise your computer for peak performance. In three simple steps, you can resolve PC issues and remove virus damage:

  1. Download Outbyte PC Repair Software
  2. Click Start Scan to detect Windows 10/11 issues that may be causing PC issues.
  3. Click Repair All to fix issues with your computer’s security and performance.
    This month, Outbyte has been downloaded by 23,167 readers.

DiskPart is not a new concept. It has been the part of the Windows even before Windows 10. It is the best alternative when other disk utility such as Disk Management Tool fails to work.

In this guide, we would learn to use the common DiskPart commands to fix ‘Drive not Working’ and other disk errors.

How to open DiskPart on Windows 10?

Launching the DiskPart is not a big task. You just require to open the command terminals, either the Command Prompt or Windows PowerShell with the administrative rights. 

In this guide, we would use the Command Prompt to run the DiskPart commands. The same commands can be directly used in Windows PowerShell without any changes.

  1. Search Command Prompt in the Windows search bar and launch it with admin rights.

    Open Command Prompt as Admin

  2. In the command window, type diskpart and hit enter. The DISKPART tool would be open and ready to use.

    launch DISKPART

  3. If you want to glance on the full list of available commands of DiskPart type help in the command window and press the enter key.

    diskpart help command

  4. After using it, type Exit and hit the enter key to exit the tool.

    Exit DiskPart

Common DiskPart Commands

We would now explore the common DiskPart Command Prompt commands that you will mostly require.

Command Description
ACTIVE Mark the selected partition as active.
ADD Add a mirror to a simple volume.
ASSIGN Assign a drive letter or mount point to the selected volume.
ATTRIBUTES Manipulate volume or disk attributes.
ATTACH Attaches a virtual disk file.
AUTOMOUNT Enable and disable automatic mounting of basic volumes.
BREAK Break a mirror set.
CLEAN Clear the configuration information, or all information, off the disk.
COMPACT Attempts to reduce the physical size of the file.
CONVERT Convert between different disk formats.
CREATE Create a volume, partition, or virtual disk. (No virtual disk management in Windows XP.)
DELETE Delete an object.
DETAIL Provide details about an object.
DETACH Detaches a virtual disk file.
EXIT Exit DiskPart.
EXTEND Extend a volume.
EXPAND Expands the maximum size available on a virtual disk
FILESYSTEMS Display current and supported file systems on the volume.
FORMAT Format the volume or partition.
GPT Assign attributes to the selected GPT partition.
HELP Display a list of commands.
IMPORT Import a disk group.
INACTIVE Mark the selected partition as inactive.
LIST Display a list of objects.
MERGE Merges a child disk with its parents.
ONLINE Online an object that is currently marked as offline.
OFFLINE Offline an object that is currently marked as online.
RECOVER Refreshes the state of all disks in the selected pack. Attempts recovery on disks in the invalid pack, and resynchronizes mirrored volumes and RAID5 volumes that have stale plex or parity data
REM Does nothing. This is used to comment scripts.
REMOVE Remove a drive letter or mount point assignment.
REPAIR Repair a RAID-5 volume with a failed member.
RESCAN Rescan the computer looking for disks and volumes.
RETAIN Place a retained partition under a simple volume.
SAN Display or set the SAN policy for the currently booted OS.
SELECT Shift the focus to an object.
SETID Change the partition type.
SHRINK Reduce the size of the selected volume.
UNIQUEID Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature of a disk.

Listing Existing Hard Drives, Volumes & Partitions using DiskPart

Before applying any destructive commands, you can first check the current internal and external hard disks and USB storage layout.

To check the available disks:

  1. Open the DiskPart and after “DISKPART>” prompt type list disk and hit enter. This command will list all the available and detectable storage disks, including internal and external drives and USB storage.
    Diskpart list disk command

  2. To apply the DiskPart commands on the disks, you need to remember the disk number. For example, the windows disk is “Disk 0.

To display the list of detected Volumes:

  1. Launch DiskPart and next to “DISKPART>” prompt type list volume.
    diskpart list volume command

  2. All volumes would be listed.

Check the list of partitions:

  1. To check the partition list, you must first select the hard disk with the list disk command.
  2. After the disk list is displayed, type select disk followed by the disk number.
    diskpart select disk command

  3. Once the disk is selected, type list partition, and hit the enter key, the selected disk’s partition list will be displayed. You can further modify the partitions using the partition number.
    Diskpart list partition command


How to Delete Hard Drive, Volume, and Partition using DiskPart ?

If you want to delete the Volume or Partition of your system’s hard disk using Diskpart, follow these steps:

  1. First, select the hard drive using the select disk command, followed by the disk number.
  2. Now open the partition list of the chosen disk using list partition command.
  3. Chose the partition using select partition # command, replace with the required partition number.
  4. Once the partition is selected, you can delete it using the delete partition command. The partition will be deleted.
    Select and Delete the Partition using DiskPart

  5. Similarly, you can delete the disk volume. Type list volume, check your chosen volume number, then type select volume #, replacing # with your volume number.
    Delete volume using DiskPart

  6. Type delete volume, to delete the chosen volume.

How to Completely Wipe Out the Hard Disk using DiskPart?

If you face a problem in formatting the system hard disk, external hard drive, or the USB Pendrive, then using DiskPart, you can easily wipe them out. Obviously, you won’t be able to clean the disk on which your OS is installed.

  1. Similar to previous steps, on the DISKPART prompt window, type list disk.
  2. By typing select disk # command where is your disk number, choose the disk that you want to format completely.
  3. After selecting the disk, type clean command to format it completely. Remember that it would not warn you, so make sure that you have selected the correct disk.
    Clean disk using DiskPart

  4. After the cleanup, DiskPart would display the success message, and the disk would be ready for creating the new partitions. 

How to Create and Format New Hard Drive Partitions using DiskPart?

Using the steps from the last section, you might have cleaned your hard disk. Now its time to create the new partitions and format them with Windows-friendly file systems like NTFS or FAT32.

create a new partition using diskpart

  1. Open the disk list using the list disk command and select the disk using the select disk # command, where # is the disk number.
  2.  After selecting the disk type the create partition primary command to create a partition using the entire space on that drive.
  3. If you want to create multiple partitions, you can assign how much space a partition could take. For that type, create partition primary size=X, where X is the size that you wish to set to the partition.
  4. To ensure that the new partition is listed, type list partition command.
  5. Use active command to activate the partition. It is required to use the partition as a bootable drive.
  6. To format the partition with the NTFS file system, use format FS=NTFS label=Data quick command. You can replace Data with any label you want.
  7. After it gets format, the DiskPart would automatically assign the letter to the partition. If it doesn’t, you can manually set it. For that type, assign letter=g, where you can replace g with any drive letter that you want. 
Format the partition and assign letter to it using diskpart


Conclusion

These are the top used DiskPart commands that you can use to fix your hard drive problems and clean the USB drives and hard disks.

There are more commands, too, if you want to know about them, type help after launching DISKPART in the command window.

1. How to open DiskPart in Windows 10?

You can open DiskPart utility through Command Prompt or Windows PowerShell in Windows 10. After launching any of the command terminals, type diskpart to launch DiskPart.

2. How to fix hard drive problems with DiskPart?

DiskPart utility is specifically available for solving the disk issues on Windows 10. After launching the diskpart, type the help command to know about all the commands supported by diskpart. This post guides you on how to use the most common DiskPart commands.

Peter is an Electrical Engineer whose primary interest is tinkering with his computer. He is passionate about Windows 10 Platform and enjoys writing tips and tutorials about it.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Список проблемных обновлений windows 10
  • Youtube viewer windows 10
  • Резервное копирование рабочих станций windows
  • Microsoft помощник по обновлению до windows 11
  • Симулятор windows xp что это