How to Format a Hard Drive With Command Prompt

Techwalla may earn compensation through affiliate links in this story.
You can use the command prompt to format a hard drive.

The command prompt in Windows is one of the quickest ways to format a hard drive. In fact, it might be the only method available, if you find that you are unable to start your computer except in Safe Mode or you are booting with a floppy disk or CD because you have not yet installed Windows. Format a hard drive to remove existing files from the disk and prepare it for use.


Step 1

Open the "Start" menu if you are able to load the Windows desktop. Click "Computer" and a list of your computer's hard drives recognized by Windows will be displayed. Note the letter assigned to the hard drive that you want to format, such as "D:" or "E:." Note the volume label, too, which might be "Local Disk" or "New Volume." Close the window. If you are unable to load the Windows desktop, skip to Step 3.

Step 2

Open the "Start" menu again and type "cmd" (without quotes) in the search box. Press "Enter." Windows displays the command prompt.


Step 3

Type "format (drive letter)" at the command prompt and press "Enter." If you want to format drive "D:", for example, type "format D:" and press "Enter."

Step 4

Type the volume label that you noted in Step 1, if applicable, and press "Enter."

Step 5

Type "Y" to confirm that you want to proceed. Press "Enter" to format the hard drive.


Step 6

Type a new volume label for the hard drive and press "Enter." Alternatively, press "Enter" without typing a volume label to skip naming the hard drive.


You cannot format the hard drive on which the Windows operating system is installed – usually drive C: – while Windows is running. If you want to format the operating system hard drive, you must boot the computer with a startup CD or floppy before proceeding.

Before formatting any hard drive, double-check its contents to confirm that it does not contain any files you want to keep; if it does, back up those files before you proceed. Formatting a hard drive deletes its contents, and data recovery from a formatted hard drive can be difficult and costly.