Microsoft DOS diskpart command

Quick links

About diskpart
Availability
Syntax
Examples

About diskpart

The diskpart command is a recovery console command that enables a user to delete and create partitions on their computer.

Availability

The diskpart command is a recovery console command that is available in the below Microsoft operating systems.

Windows 2000
Windows XP
Windows Vista
Windows 7

Syntax

Creates and deletes partitions on a hard drive. The diskpart command is only available when you are using the Recovery Console.

diskpart [/add | /delete] [device_name | drive_name | partition_name] [size]

/add Creates a new partition.
/delete Deletes an existing partition.
device_name The device you want to create or delete a partition. The name can be obtained from the output of the map command.
drive_name The partition you want to delete, by drive letter. Used only with /delete.
partition_name  The partition you want to delete, by partition name. Can be used in place of the drive_name. Used only with /delete.
size The size, in megabytes (MB), of the partition you want to create. Used only with /add.

Examples

diskpart /delete D:

In the above example the D: partition would be deleted.

diskpart /add \Device\HardDisk0 20

In the above example a 20MB would be created on the HardDisk0 device. This name is obtained from the map command.

  • Category
  • MS-DOS
  • Companies
  • Microsoft
  • Solved?
  • Were you able to locate the answer to your question?