CMD Command to Wipe Hard Drive on Windows 10 or 11 Safely

You’ll learn the CMD command to wipe hard drive on Windows 10 or 11 safely and completely, along with an easier method - using dedicated disk wiping software - AOMEI Backupper.

By @Ivy
Last Updated December 18, 2025

DiskPart Clean vs Clean All

On Windows, a CMD command allows you to control disk operations directly through the Command Prompt, without relying on a graphical interface. When wiping a hard drive using CMD, DiskPart serves as the core Windows utility, with “clean” and “clean all” being the two most common commands, with different purposes.

 

DiskPart clean

DiskPart clean all

Purpose

Removes all partitions and disk structure

Write zeros to every sector to fully erase data

What It Removes

Partition table and volume information

Partitions and all data

Overwritten

No

Yes (entire disk)

Recoverable

Yes

Extremely unlikely

Speed

Very fast (seconds)

Slow (minutes to hours)

Security Level

Low

High

Best Use

Repartition, or reinstall Windows

Wipe a hard drive before recycling, selling, or giving away

Use CMD (DiskPart) Command to Wipe Hard Drive

Warning: DiskPart commands take effect immediately and cannot be undone. Back up any important data beforehand. Double-check the disk number, size, and type before proceeding.

Step 1. Press Win + S, type cmd, and select Run as administrator. Click Yes when prompted.

Step 2. In the Command Prompt window, type diskpart and press Enter to open this utility

Step 3. Then, type the following commands to identify and clean the entire disk.

  • list disk
  • select disk 1
  • clean all
  • exit

Note: To confirm the selected disk, add another command: detail disk after selecting the disk.

The process can take minutes to hours, depending on disk size and type. Do not close the window or interrupt the process.  DiskPart will display a message when the wipe is finished. After completion,

  • all partitions are removed.
  • the drive becomes unallocated space.
  • data recovery is extremely unlikely.

Best Alternative to CMD Wiping Hard Drive

While CMD and DiskPart provide powerful commands for wiping a hard drive, they are not always the best choice for every user, especially those without advanced technical experience. It requires precise commands, offers no visual confirmation, and leaves little room for error.

By comparison, dedicated disk wiping software like AOMEI Backupper Professional is safer and easy to use, featuring a user-friendly interface that allows you to select what and how to wipe in a few clicks. It offers users more options than CMD and is fully compatible with Windows 11, 10, 8.1/8, and 7.

AOMEI Backupper
The Best Disk Wiping Software for Windows
  • 3 wiping options: Wipe partition(s), unallocated space, or the entire drive, e.g., HDDs/SSDs, external hard drives, USB drives, etc.
  • 4 disk wiping levels: File sectors with zero, random data, DoD 5220.22-M, and Gutman.
  • Bootable disk wipe: Create a bootable USB to wipe hard drive without OS.
  • Storage compatibility: Wipe hard drive from SanDisk, Samsung, WD, Seagate, etc.
  • More advanced backup features: Support file backup, system backup, schedule backup, etc., for data protection.

Step 1. Open AOMEI Backupper after installing. Then, go to Tools and click Disk Wipe.

Step 2. Select Wipe disk, then hard drive you want to erase.

Step 3. Select a disk wiping method, depending on the disk types and how thoroughly you want to erase the disk.

  • Fill sectors with Zero - Quick but relatively basic.
  • Fill with random data - Safer than Zero.
  • DoD 5220.22-M - Multiple passes, based on U.S. Department of Defense standards.
  • Gutmann - 35 passes; extremely secure but very slow.

Step 4. At last, click Start to wipe hard drive without CMD.

In addition, you can also use this software to wipe USB flash drive, unallocated space, SATA drive, NVMe SSD, etc.

Final Result

After using CMD command to wipehard drive, the drive is returned to a clean, blank state. All partitions and file system information are removed, and when the clean all command is used, the underlying data is overwritten, making recovery extremely unlikely. In Disk Management, the drive will appear as unallocated space,with nopartition or drive letter remain, confirming the wipe was completed.

However, CMD and diskpart is not always the best option, especially for novices, who are not familiar with commands and prone to making mistakes, leading to data loss or system failure. It’s suggested to use a dedicated disk wiping software to erase and clean a drive, from basic overwriting to secure erase.

Free Download Win 11/10/8.1/8/7
Secure Download