Formats the partition or volume with focus for use with Windows.

For examples of how this command can be used, see Examples.

Syntax

format [{fs=<ntfs|fat|fat32>] [revision=<x.xx>] | recommended}] [label=<"label">] [unit=<n>] [quick] [compress] [override] [nowait] [noerr]

Parameters

Parameter Description

fs=<ntfs|fat|fat32>

Specifies the type of file system. If no file system is specified, the default file system is used. The default file system is displayed by the filesystems command in DiskPart.

revision=<x.xx>

Specifies the file system revision (if applicable).

recommended

If a recommended file system exists, it uses that file system and revision, instead of the default file system and revision. The recommended file system (if one exists) is displayed by the filesystems command in DiskPart.

label=<"label">

Specifies the volume label.

unit=<n>

Overrides the default allocation unit size. Default settings are strongly recommended for general use. The default allocation unit size for each file system supported by the volume is displayed by the filesystems command in DiskPart. Note that NTFS compression is not supported for allocation unit sizes above 4096.

quick

Performs a quick format.

compress

Only for volumes that will be formatted with the NTFS file system. Files created on the new volume will be compressed by default.

override

Forces the volume to dismount first if necessary. All opened handles on the volume will no longer be valid.

nowait

Format will return immediately while the format is still in progress. If this parameter is not specified, DiskPart will print out formatting progress in percentage.

noerr

For scripting only. When an error is encountered, DiskPart continues to process commands as if the error did not occur. Without this parameter, an error causes DiskPart to exit with an error code.

Remarks

  • A partition or volume must be selected for this operation to succeed. Use the select partition or the select volume command to select a partition or volume and shift the focus to it.

Examples

To perform a quick format of a partition or volume with the NTFS file system, assign the "Main Volume" label to it, and specify that files added to the new volume be compressed by default, type:

format fs=ntfs label="Main Volume" quick compress

Additional references