Generate summary with AI

Command Prompt gives you options that File Explorer simply doesn’t, such as partition-level control through diskpart, the ability to wipe a RAW or corrupted drive down to bare metal, and a path to scripting the whole process for repeat use. That last part matters more than it used to.

This guide walks you through exactly how to do it from the command line, from picking the right format type and file system to running the format itself through format or diskpart, scripting it for repeatable deployments, and verifying the drive’s health once you’re done.

» Learn how to use Command Prompt correctly

Choosing the right format and file system

Before you actually format a drive, you need to know what type of format you need and which file system fits how the drive will be used. Misunderstanding this could mean wasting hours on an unnecessary full format or setting up a drive that won’t work with the systems it needs to talk to.

Quick format vs. full format vs. low-level format

These three terms get used interchangeably, but they do very different things to the drive and the data on it.

Format type

What it does

What data gets removed

Time required

Quick format

Rebuilds the file system and partition table

Files remain recoverable until overwritten

Seconds

Full format

Removes files and scans the disk for bad sectors, writing zeros to every sector

Data recovery becomes very difficult

Minutes to hours, depending on drive size

Low-level format (LLF)

Redefines the physical media layout at the factory level

N/A; not performed by end users

N/A

Pick quick format when you’re reusing a healthy drive and don’t need to verify sector integrity. Pick full format when you’re decommissioning a drive, need bad-sector scanning, or need higher confidence that old data won’t be recoverable.

Note: Low-level format gets misused constantly. True LLF defines the physical layout of the media and isn’t something you can run on a modern drive as an end user since it happens at the factory. When someone says they want to “low-level format” a drive today, what they usually mean is a zero-fill or secure erase procedure using the drive’s own firmware, not an actual LLF.

NTFS vs. exFAT vs. FAT32

The file system determines what the drive can do once it’s formatted, and getting this wrong causes more support tickets than the format type does.

File system

Best for

Key traits

NTFS

Dedicated Windows OS drive

Required for the Windows boot drive on modern versions; supports file-level permissions, journaling, and compression

exFAT

Cross-platform portable storage

Natively supported on Windows, Linux, and macOS; supports files larger than 4 GB

FAT32

Legacy compatibility

Used when the target device is older or specifically requires it; capped at 4 GB per file

If the drive is going into a Windows machine as a boot or system drive, NTFS isn’t optional because it’s the only file system Windows will accept for that role, and you get journaling as a safety net against corruption from sudden power loss.

If the drive needs to move between a Windows machine, a Mac, and a Linux box, exFAT is the practical default. FAT32 only comes into play when you’re dealing with older hardware or a device that specifically demands it, and the 4 GB file size ceiling is the thing that trips people up most often.

» Learn more: NTFS vs FAT

How to properly prepare and execute the format

Before running anything destructive, confirm you’re targeting the correct drive. This applies to every method below, so get it right once here rather than re-verifying it for each approach separately.

First identify the correct drive

  1. Back up any data you need to keep since formatting destroys the file system and may erase data
  2. Disconnect any non-essential external drives to reduce the risk of selecting the wrong disk
  3. Open Command Prompt as administrator

    Open CMD as admin
  4. Run diskpart to open the partition manager utility
  5. Run list disk to display all connected disks
  6. Run select disk <number> to select the disk you intend to format
  7. Run detail disk to display detailed information about the selected disk and confirm it’s the right one
  8. Run list volume to cross-check drive letters, labels, and file systems before formatting. You can also cross-check this in File Explorer

    Diskpart commands in CMD
  9. If you lose track of which disk is currently selected, run list disk again, and an asterisk will appear next to the active disk
  10. If the drive isn’t partitioned, detail disk will return a There are no volumes message, which is expected

    There are no volumes message in CMD
  11. Run exit to leave the diskpart utility once you’ve confirmed the target

With the correct drive confirmed, pick one of the three methods below depending on what you’re trying to accomplish.

Method 1: Quick format with the format command

Use this when you already have a drive letter assigned and just need a straightforward quick format. It’s the fastest path for a healthy drive you’re reusing.

  1. Exit the diskpart utility if you haven’t already
  2. Run format X: /FS:<FILE_SYSTEM> /Q, replacing X with your drive letter and <FILE_SYSTEM> with your chosen file system (for example, NTFS)
  3. Optionally, add the /V:label argument to label the volume
  4. Press Y to confirm the action, or N to abort, then press Enter

    Quick format command in CMD

Consult Microsoft’s official format command documentation for the full list of supported arguments and syntax.

Method 2: Reformat an existing partition with diskpart

Use this when you need to reformat a specific partition without touching the rest of the disk, which is useful for a healthy partition that just needs a clean file system.

  1. Start diskpart from an elevated Command Prompt window
  2. Run list disk to display all connected disks
  3. Run select disk <number> to select the desired disk
  4. Run list partition to show the partitions on the currently focused disk
  5. Run select partition <N> to select the specific partition
  6. Run detail partition to confirm you’ve selected the right one before proceeding
  7. Run format fs=ntfs quick to perform a quick format on the selected partition using the NTFS file system

    Reformat existing partition command

You can switch to a different partition at any point by running select partition <N> (or select volume <N>), then list partition (or list volume) to confirm the asterisk has moved to the newly selected entry.

Select new partition command

» Here’s how to use Disk Cleanup in Windows 11

Method 3: Scripting the format for unattended deployment

Use this when you need to format the same way across multiple machines instead of running commands by hand on each one, which is the practical way for IT technicians to cover multiple endpoints.

First, you’ll need to create a DiskPart script file:

  1. Create a new text document
  2. Enter your sequence of commands, one per line, such as select disk 1, clean, convert gpt, create partition primary, format fs=ntfs quick label="BackupDrive", assign letter=D
  3. Save it to a location all PCs can reach and name it something like backup_format_script.txt

    Create DiskPart script file

Then, you’ll need to create a batch file:

  1. Create a new text document
  2. Enter @echo off on the first line
  3. On the next line, enter diskpart /s backup_format_script.txt, pointing to the script file’s saved location
  4. Save the file with a .bat extension, such as format_backup_drive.bat

    Create batch file for DiskPart

Once you’ve validated the script on a test machine, running it endpoint by endpoint stops being practical past a handful of machines. Atera’s RMM lets you deploy the same batch file remotely through Command Prompt, pushing it out and triggering execution across your managed endpoints from a single console instead of touching each PC individually. Results and any errors are logged centrally rather than scattered across C:Logs on separate machines.

A few things to keep in mind with this approach:

  • In order to run multiple DiskPart scripts you need to allow at least 15 seconds between each script (add timeout /t 15 between calls in the batch file).
  • Error handling is problematic since, by default, a script stops on error. You can use the noerr parameter can be used (for example clean noerr) to continue through non-critical failures.
  • Logging can be done by saving the output to a file: diskpart /s format_script.txt > C:Logs%COMPUTERNAME%_backup_format.log.

For more complex deployments, a PowerShell script using cmdlets like Clear-Disk, New-Partition, or Format-Volume is often more practical than a batch/DiskPart combination, since PowerShell returns structured objects rather than plain text, which makes error handling more reliable.

» Confused about the extensions? Here’s how to show file extensions in Windows 11

Handling edge cases and verifying the result

Not every format goes cleanly. Here’s what to do when a drive won’t cooperate, plus how to confirm the drive is actually healthy once you’re done.

Rescuing a RAW or severely corrupted drive

Use this when a drive shows up as RAW or has a corrupted partition table that a standard format won’t touch. It wipes the partition table entirely and rebuilds it from scratch.

  1. Start diskpart from an elevated Command Prompt window
  2. Run list disk to display all connected disks
  3. Run select disk <number> to select the affected disk
  4. Run clean to wipe the partition table on the selected disk. If you need a more secure erase, use clean all instead, which writes zeros to every sector
  5. Run create partition primary to create a new primary partition; this automatically shifts focus to the new partition
  6. Run format fs=ntfs quick label="NewName" to format the new partition
  7. Run assign letter=D to mount the partition, replacing the drive letter as needed

    Rescue RAW or severely corrupted drive

Resolving write-protected or access-denied errors

Use this when the drive throws a “write-protected” or “access denied” error during formatting. It clears the read-only attribute that’s blocking the operation.

  1. Start diskpart from an elevated Command Prompt window
  2. Run list disk to display all connected disks
  3. Run select disk <number> to select the affected disk
  4. Run attributes disk clear readonly to clear the read-only attribute on the selected disk
  5. If the issue is specific to a volume rather than the whole disk, run select volume <N> followed by attributes volume clear readonly instead

    Resolve write-protected drive issues

If clearing the read-only attribute doesn’t resolve it, it could also be caused by not running Command Prompt as administrator, a physically failing drive, or a corrupted file system.

» Did you know you can set something to always run as administrator?

Verifying drive integrity after formatting

Run this immediately after formatting to confirm the drive’s structural integrity and sector health before putting it back into service.

  1. Run chkdsk X:, replacing X: with the corresponding drive letter, to check the file system and logical structure
  2. Add /f to the command to fix logical errors it finds
  3. Add /r to locate bad physical sectors and attempt to recover readable information from them
  4. Add /x to force the volume to dismount first, allowing a deeper scan

    Verify drive integrity

Command-line formatting gives you control the GUI can’t

Command-line formatting gives you the precision GUI tools can’t. It gives you the right format type for the job, the right file system for how the drive will be used, and a repeatable process instead of a one-off click-through. Once you’ve got that down, scaling it is the next natural step because nobody wants to run the same nine diskpart commands by hand across forty endpoints.

That’s where Atera comes in. IT teams and MSPs managing more than a handful of machines can deploy the same scripts remotely across every managed endpoint, on a schedule, with the results logged centrally instead of scattered across individual terminal sessions.

Frequently Asked Questions

Was this helpful?

Related Articles

How to enable Ultimate Performance Power Plan in Windows 11

Read now

How to open Disk Management in Windows 10

Read now

How to check hard drive health

Read now

How to turn off Smart App Control in Windows 11

Read now

Endless IT possibilities

Boost your productivity with Atera’s intuitive, centralized all-in-one platform