Diskpart Command Availability

The diskpart command is available from within the Command Prompt in Windows operating systems, including Windows 11, 10, 8, etc.

You can also access this command from the Recovery Console in Windows 2000 and Windows XP.

Diskpart Command Syntax

diskpart

Create 5 GB Partition

In the above example, the diskpart command creates a 5,000 MB partition on the hard drive located at \Device\HardDisk0.

Delete Partition by Name

For this one, the diskpart command will remove the Partition1 partition located on the hard drive \Device\HardDisk0.

Delete Partition by Letter

This command will remove the partition currently assigned the drive letter G.

Select a Disk

Finally, in this multi-part command, diskpart is being used to select a particular disk, disk 1 in this example, so that we can remove the readonly attribute that’s been set on it. We have a full guide on removing write protection if you need more information.

The fixboot, fixmbr, and bootcfg commands are often used with the diskpart command.