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

Use a Windows 7 System Repair Disc to wipe a hard drive from the Command Prompt

What to Know

  • Make a System Repair Disc, and then boot from it.
  • Select Next > Use recovery tools > Next > Command Prompt.
  • Enter format e: /fs:NTFS /p:2 and follow the on-screen steps.

This article describes how to write zeros to a hard drive to erase all the data on Windows 7 and newer. Instructions include how to format the drive in a special way using the format command.

How to Zero-Fill a Hard Drive With the Format Command

Since you can write zeros to a hard drive with the format command both from within Windows 7 and Windows Vista and from outside the operating system, we've created two ways to proceed through these instructions. This process could take several minutes to several hours.

Start at Step 1 if you need to write zeros to the primary drive, usually C, of any Windows operating system OR if you want to write zeros to any drive on a computer with Windows XP or earlier. Start at Step 6 if you need to write zeros to a drive other than the primary drive in Windows Vista or later; you'll need to have an elevated Command Prompt window open and ready.

  1. Create a System Repair Disc in Windows 7. You'll need access to a Windows 7 computer to do this. However, it doesn't need to be your Windows 7 computer. If you don't have a Windows 7 PC, then find a friend that does and create a repair disc from their computer.

    Create a system repair disc window in Windows 7

    If you don't already have or can't find a way to create it, then you won't be able to write zeros to a drive in this way.

    See our Free Data Destruction Software Programs list for more options.

    If you have a Windows Vista or Windows 7 Setup DVD, you can boot to it in lieu of creating a System Repair Disc. The directions from this point forward using a setup disc will be generally the same.

  2. Boot from the System Repair Disc and watch for the Press any key to boot from CD or DVD... message after your computer turns on, and be sure to do that. If you don't see this message but instead see the Windows is loading files... message, that's fine.

  3. Wait for the Windows is loading files... screen. When it's over, you should see a System Recovery Options box. Change any language or keyboard input methods you need to and then select Next >.

    Don't worry about the "loading files" message...nothing is being installed anywhere on your computer. System Recovery Options is just starting, which is needed to get to the Command Prompt and ultimately to write zeros to your hard drive.

  4. A little dialog box appears next that says "Searching for Windows installations...". After several seconds, it will disappear and you'll be taken to a System Recovery Options window with two options. Choose Use recovery tools that can help fix problems starting Windows. Select an operating system to repair. and then select Next >.

    Your operating system may or may not be listed. If you're using another operating system like Windows XP or Linux, nothing will show up here—and that's OK. You do not need a compatible operating system on this computer to write zeros over the data on the hard drive.

  5. Select Command Prompt from the System Recovery Options screen.

    This is a fully functional version of the Command Prompt and contains most of the commands you'd expect to be available from the Command Prompt in an installed version of Windows 7. This, of course, includes the format command.

  6. At the prompt, type the following, followed by Enter:

    format e: /fs:NTFS /p:2

    The format command used in this way will format the E drive with the NTFS file system and write zeros to every sector of the drive twice. If you're formatting a different drive, change e to whatever drive letter you need. It doesn't matter what OS is on the computer.

    A single pass of zeros to a hard drive should prevent all software based file recovery programs from extracting information from the drive, which the format command in Windows 7 and Vista does by default. However, you might do two passes via this method just to be safe. Even better, if you'd like to protect yourself from more invasive ways of recovering data, choose a true data destruction program with more advanced options.

  7. Enter the volume label of the drive you're formatting when asked, and then press Enter. The volume label is not case sensitive.

    Enter current volume label for drive E:

    If you don't know the volume label, cancel the format using Ctrl+C and then see How to Find the Volume Label of a Drive From the Command Prompt.

    If the drive you're formatting doesn't have a label then, logically, you won't be asked to enter it. So, if you don't see this message it just means that the drive you're formatting doesn't have a name, which is fine. Just move on to Step 8.

  8. Type Y and then press Enter when prompted with the following warning:


    You can not undo a format! Be very sure that you want to format and permanently erase this drive! If you're formatting your primary drive, you will remove your operating system and your computer will not work again until you install a new one.

  9. Wait while the format completes.

    Screenshot of the format write zero command in a command prompt from a System Recovery Disc

    Formatting a drive of any size may take a long time. Formatting a large drive may take a very long time. Formatting a large drive with multiple write-zero passes may take a very, very long time.

    If the drive you're formatting happens to be very large and/or you've chosen to make several write-zero passes, don't worry if the percent completed doesn't even reach 1 percent for several seconds or even several minutes.

  10. After the format, you'll be prompted to enter a Volume label. Type a name for the drive, or don't, and then press Enter.

  11. Wait while Creating file system structures is displayed on the screen.

  12. Once the prompt returns, repeat the above steps on any other partitions on this physical hard drive. You can't consider the data on an entire physical hard disk destroyed unless you actually format all the drives on the disk using this method.

  13. You can now remove the System Repair Disc and turn off your computer. If you've used the format command from within Windows, just close the Command Prompt.

    If you try to boot to a drive that you've erased all the information from, it will not work because there's no longer anything there to load. What you'll get instead is a "BOOTMGR is missing" or an "NTLDR is missing" error message, meaning there was no operating system found.

With all the data replaced by zeros, there's no longer any information to be found on your hard drive by a file recovery program.

Was this page helpful?