Windows - The DISKPART command

October 2016

Windows - The DISKPART command

DISKPART can be used to overcome the limitations of the Disk management tool. It offers several commands to manage your disks and in this article we shall discuss about the most popular ones.

The DISKPART command

Diskpart is a command line tool which allows you to manage disks, as such some commands can only be accessed via diskpart and not by the disk management tool of Windows. The use of this tool involves a lot of caution!

DISKPART can be useful in such situations:
  • Access to disks that no longer appear in the disk management tool.
  • Convert a basic disk to a dynamic disk.
  • Create partitions.
  • The clean command allows you to delete all information stored on the disk.
  • Manage the partitions (create, delete, edit).
  • Assign, edit and delete a drive letter.
  • Format a partition (several options available).

The different ways to use diskpart

  • Script
  • CMD (command prompt)

Using diskpart via a script

  • Click on Start > Run.
  • Type cmd and press Enter.
  • The command prompt shall open.

From there we will simply indicate where diskpart will find the file containing the commands.
  • Move to the folder containing the files using the
  • In our case we will use the example.txt file.
    • diskpart.exe /s exemple.txt
  • The example.txt file will contain the commands. In our example we will list the details of disk 1:

list disk
select disk 1
detail disk

Using DISKPART via the command prompt

  • Click on Start > Run.
  • Type cmd and press Enter.
  • Once the command prompt is open
  • Type:
You have now accessed the diskpart tool.

Listing the disks

  • You can list the disks, partitions or volumes.
  • You can use both the disk management tool of Windows and the diskpart tool, by positioning both of the windows side by side.

Selecting a specific disk

  • Type the following command:
    select disk n
  • Replace n with the disk number of your choice.

Getting info about a disk

For more information use the detail disk command.
To get information about a specific disk, first you need to select it and the use the detail disk command.
Example using the disk 2 :
list disk
select disk 2
detail disk

Selecting a partition

First you need to select the disk:
list disk
select disk n
Then use the below command to select the partition of your choice:
select partition n
Replace n with the partition number
To get additional information about a partition:
list partition
select partition n
detail partition

Selecting a volume

First you must select your disk:
list disk
select disk n
List the volumes present using the below command:
list volume
To select a specific volume:
select volume n 
Where n is the the volume number
To get information about the selected volume, type:
detail volume

Additional commands

The help command

The help command will give you access to all the diskpart commands:
help <command> 
Example :
help clean

The clean command - Clear all information

  • The CLEAN command deletes all partitions, the configuration information and all the information stored on the disk.
  • The CLEAN ALL command deletes all partitions on the selected disk and permanently deletes the information stored on the disk.

Example of use (disk 1):
list disk
select disk 1

The ASSIGN command - manage partitions letters

The Remove letter command:
list volume
select volume n
remove letter =N
To assign a new letter to a partition:
assign letter =N

The Format command: format a partition

Format the active partition or volume.

Related :

This document entitled « Windows - The DISKPART command » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.