Table of Contents

Quick Navigation:

Today's devices store images, papers, and sensitive data on hard disks. However, protecting this wealth of personal data while selling an outdated computer or device is crucial. Command Prompt (CMD), Windows' code-savvy superhero, Consider it a digital eraser that wipes your hard drive clean, erasing your data forever.

Consider CMD your trusted wizard, waving its magic wand to erase all data, making it unrecoverable. Using CMD to protect your data is a simple method like a walkthrough. So saddle up and prepare to learn how to wipe a hard drive clean using Command Prompt securely!

Steps to Wipe a Hard Drive Clean Using CMD

Step 1: Accessing Command Prompt

Press the "Admin" key to launch the command prompt. To access CMD with administrative rights, right-click The start menu "Windows PowerShell (Admin)" or "Command Prompt (Admin)."

Step 2: Identifying the Drive

  • Find the disc that needs wiping: Enter "diskpart" into the Command Prompt. This command launches the DiskPart utility.
  • Find All Drives: Enter "list disk" and hit Enter. This command shows a complete inventory of your computer's drives.
  • wipe hard drive with CMD

  • To choose which drive to erase, use the command "select disk X," Carefully consider this drive while selecting; all that follows will affect it.
  • wipe hard drive with CMD

Step 3: Disabling the Hard Disk

Press Enter after typing clean to erase all data from the drive. After you run this command, the selected disk will have all its partitions and data deleted. Ensure you've chosen the right drive because this is an irrevocable action.

After you've cleaned the disk, it's time to create a new partition. Just type "create partition primary" and hit Enter. If you plan on reusing the drive, this step is highly recommended, although it is not required.

Step 4: Exiting DiskPart and Command Prompt

  • Shut Down Disk: To close the DiskPart program, type exit and hit Enter.
  • Type exit once more and hit Enter to close the Command Prompt.

Step 5: be patient while the cleaning procedure finishes. Pressing the Exit key will close the command prompt.

Alternative CMD Hard Drive Wiping Methods

There are several ways to erase a hard drive using CMD besides DiskPart instructions safely. For example, you can use the 'format' command with certain arguments.

Formatting the Drive:

Using the format command, you can format a drive and erase all of its data:

  • Access Command Prompt as Administrator.
  • Format the Drive: Press Enter after typing format X: /fs:ntfs /p:1, where 'X' is the drive letter you wish to format. Data is zeroed out once with the '/p:1' argument.
  • Confirm Formatting: Press Enter after typing "Y" to confirm the formatting.

Using Cipher Command:

One further command that can be used is 'cipher,' which replaces erased data on a drive:

  • Open Command Prompt as Administrator.
  • Run Cipher Command: Replace the letter 'X' with the drive letter and hit Enter to type cipher /w: X. Using this command, any free space on the drive will be replaced with zeros.

Wipe Hard Drive with DoYourData Super Eraser:

If you want to permanently erase data from a hard drive, you can try data erasure program - such as DoYourData Super Eraser. No pro skills required, you can easily and securely wipe a hard drive on your Windows PC or Mac.

Step 1. Download and install DoYourData Super Eraser on your computer.

Step 2. Open DoYourData Super Eraser, then choose data erasure mode - Wipe Hard Drive.

wipe hard drive with CMD

Step 3. Select the target hard drive you want to wipe, then click on Wipe Now button to securely and permanently wipe all data off.

wipe hard drive with CMD

FAQs About Wiping Hard Drive

1. How to wipe to clean a disk using CMD?

Using the CMD command prompt, you can do more than delete all the partitions on your hard drive. Wiping a drive with CMD is also possible using the given commands. In this instance, the clean all command is utilized.

The clean all command deletes all data from the disk, making it unusable for recovery, in contrast to the clean command. When you choose option 2, all data and partitions are permanently removed, and the drive is returned to its factory settings.

If you want to clean all the command lines on your internal or external hard drives, follow these procedures.

Step 1. Start typing "cmd" into the search box after pressing Windows + S. The next step is to right-click on Command Prompt. Choose the option to run as an administrator. You will see a conversation box open up. Press the Yes button to proceed.

Step 2. An obscure window resembling the CMD command prompt will subsequently pop up. Hit Enter after typing diskpart.

Step 3. type in the following commands sequentially, pressing Enter after each.

  • List disk
  • choice of disc 0 (In this case, there is just one disk 0. Input the number of the disk you want to target, replacing 0 with that number.)
  • clean all

2. Can I recover lost data after CMD erasure?

Yes, you can download a data recovery program to scan the erased hard drive, then find the lost files.

3. How to wipe a hard drive and permanently erase all data?

  • Download and install DoYourData Super Eraser, open it.
  • Choose Wipe Hard Drive mode.
  • Select the hard drive and click on Wipe Now button.


You've made Command Prompt a reliable tool to protect your sensitive data. Follow this instruction to safely wipe a hard disk, ensuring your data is irretrievable. Data security is critical in our digital era, so safeguard your data proactively.

CMD instructions are irreversible and cause full data loss, so be careful. You may now confidently use CMD to sell a computer, recycle outdated equipment, or protect your privacy. Stop worrying about your info being stolen. You can now secure your digital footprint and data with this new skill. Explore, stay alert, and embrace digital security!

DoYourData Author

Written & Updated by Shirly Chen

Shirly Chen has been writing data recovery, data erasure articles for DoYourData over 4 years. She has been working as a professional website content writer & editor for quite a long time. She also writes articles about disk clone, Mac optimization, disk backup, etc.

Read full bio