The diskpart Command Prompt command is used to create or delete partitions on hard drives.

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 

Managing partitions is also possible without the use of a command from within any version of Windows using the Disk Management tool.

The availability of certain diskpart command switches and other syntax may differ from operating system to operating system. See How to Read Command Syntax if you’re not sure how to read the syntax as it’s described in this table.

Diskpart Command Examples

diskpart /add \Device\HardDisk0 5000

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

diskpart /delete \Device\HardDisk0\Partition1

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

diskpart /delete G:

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

diskpart list disk select disk 1 attributes disk clear readonly exit

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.

Get the Latest Tech News Delivered Every Day

  • Fixboot Command (Recovery Console)

  • What Is a Disk Signature and Why Is It Necessary?

  • Copy Command

  • AOMEI Partition Assistant Standard Edition v9.13.1

  • Fixmbr Command (Recovery Console)

  • Vol Command Examples and Options

  • Rename Command

  • Net Send Command

  • 35 Best Free Data Destruction Software Programs

  • How to Remove Write Protection on a Micro SD Card

  • What Is a Partition?

  • Net Command

  • How to Use the Format Command to Write Zeros to a Hard Drive

  • Windows 7 Command Prompt Commands

  • More Command

  • Bootcfg Command

  • Facebook

  • Twitter

Hit Refresh on Your Tech News

  • About Us

  • Privacy Policy

  • Editorial Guidelines

  • Terms of Use

  • Careers

  • Advertise

  • Contact

  • EU Privacy

  • NEWS

  • HOW TO

  • FEATURES

  • ABOUT US