Format - DOS/Command Prompt Reference
Formats the drive to make it usable in MS-DOS or Windows.
Syntax
format[.com] <drive-letter>: [/V[:<label>]] [/Q] [/U] [/F:<size>] [/B | /S] [/C] [/P:<passes>]
format[.com] <drive-letter>: [/V[:<label>]] [/Q] [/U] /T:<track-count> /N:<sector-count> [/B | /S] [/C] [/P:<passes>]
format[.com] <drive-letter>: [/V[:<label>]] [/Q] [/U] [/1] [/4] [/8] [/B | /S] [/C] [/P:<passes>]
format[.com] <drive-letter>: [/FS:<file-system>] [/V[:<label>]] [/Q] [/A:<aus>] [/C] [/X] [/R:<revision>] [/D] [/P:<count>] [/S:<state>] [/I:<state>] [/TXF:<state>] [/DAX[:<state>]] [/LogSize:<size>] [/NoRepairLogs] [/NoTrim] [/DevDrv] [/Y]
<drive-letter>: |
Specifies the letter of the drive you want to format. You must include a colon ‘:’ after the letter. You cannot specify drives created with Subst or network drives. [Windows NT series] You can also specify a mount point or volume name (which can be confirmed with Mountvol) in addition to the ‘drive-letter + :’. |
||||||||||||||||||
/V[:<label>] | Specifies the volume label to be assigned to the formatted drive. If you omit this option or specify /V without providing ‘:<label>’, a prompt will appear after formatting for you to input the volume label. | ||||||||||||||||||
/Q | Performs a quick format. This is only effective for disks that are already formatted (in the same file system format as intended for the format in the case of MS-DOS). | ||||||||||||||||||
/U | [MS-DOS only] Performs an unconditional format. If this option is not specified, when formatting a previously formatted disk, the existing allocation table and root directory are retained without formatting. Additionally, if ‘/U’ is not specified and the format is interrupted soon after starting, you can use the ‘Unformat’ command to partially recover the data. | ||||||||||||||||||
/F:<size>: |
Specifies the disk size after formatting, mainly used when formatting floppy disks. If not specified, the optimal size for the drive's disk will be selected. The main values that can be specified are as follows:
|
||||||||||||||||||
/B | [MS-DOS, Windows 95/98 only] When formatting, allocates space on the disk for system files. This option is ignored in MS-DOS 6.2 and later. It cannot be used with the /S option. | ||||||||||||||||||
/S |
[MS-DOS, Windows 95/98 only] When formatting, copies system files (MSDOS.SYS, IO.SYS, COMMAND.COM, and DBLSPACE.BIN, or DRVSPACE.BIN) to the disk. As the system files are copied from the drive where the computer was booted, it inherently becomes a boot disk for that version of MS-DOS. If there are no system files on the boot drive, a message will be displayed prompting you to insert the system disk. [Windows Me] Using this option, you cannot create a boot disk. To create a boot disk, select the ‘Boot Disk’ tab from ‘Add/Remove Programs’ and follow the on-screen instructions. After creation, you can edit CONFIG.SYS and AUTOEXEC.BAT to remove unnecessary files. * In Windows Vista and later, /S has a different meaning (explained later). |
||||||||||||||||||
/C [MS-DOS, Windows 95/98/Me] | Performs a recheck of bad clusters. If /C is not specified, clusters marked as bad will remain as they are. However, if specified, a check will be performed, and if a cluster is determined not to be bad, the mark will be removed. | ||||||||||||||||||
/C [Windows NT series] | Compresses the drive. This is only effective if the file system is NTFS (in some cases, the /FS option may be required). | ||||||||||||||||||
/1 | [Windows XP or earlier] Formats only one side of the floppy disk. The drive must support this specification. | ||||||||||||||||||
/4 | [Windows XP or earlier] Formats a 5.25-inch floppy disk as 360KB, double-sided, double density. When combined with /1, it formats the disk as 180KB, single-sided, double density. | ||||||||||||||||||
/8 | [Windows XP or earlier] Formats a 5.25-inch floppy disk with 8 sectors per track. If this option is specified, the /V option (volume label specification) cannot be used. | ||||||||||||||||||
/FS:<file-system> |
[Windows NT series] Specifies the file system to use during formatting. If omitted, the file system suitable for the disk's size and type is automatically selected. Possible values include ‘FAT’, ‘FAT32’, ‘exFAT’, ‘NTFS’, ‘UDF’, etc. (varies depending on the Windows version). * ‘ReFS’ can only be specified in certain editions of Windows. |
||||||||||||||||||
/P:<count> | [Windows NT series] Writes random numbers to all sectors of the volume the specified number of times and then writes zeros. If ‘0’ is specified, only zeros are written. When used with the /Q option, it is ignored. | ||||||||||||||||||
/A | [Windows NT series] Specifies the size of the allocation unit. If omitted, the default size is used. The allowable size varies depending on the file system but must be a power of 2 equal to or greater than 512. | ||||||||||||||||||
/X | [Windows NT series] Forcibly unmounts (dismounts) the specified drive if necessary. In this case, the drive handle becomes invalid, so errors may occur in applications that were using the specified drive. | ||||||||||||||||||
/R:<revision> | [Windows NT series] In UDF formatting, specifies the UDF version. The available versions vary depending on the Windows version (you can check by running ‘format /?’). | ||||||||||||||||||
/D | [Windows NT series] In UDF 2.50, performs metadata duplication. | ||||||||||||||||||
/T:<track-count> | Specifies the number of tracks per side (single side) of the disk. Since you need to directly specify the track count, the /F option is usually used. If this option is specified, the /N option must also be specified. | ||||||||||||||||||
/N:<sector-count> | Specifies the number of sectors per track. The disk size is determined from the values specified by /T and /N. | ||||||||||||||||||
/S:<state> | [Windows Vista or later] Specifies whether to enable or disable support for short file names. <state> will be either ‘enable’ or ‘disable’. The default value (enable or disable) varies depending on the operating system. | ||||||||||||||||||
/I:<state> | [Windows Vista or later] ReFS only: Specifies whether to enable or disable integrity checking. <state> will be either ‘enable’ or ‘disable’. By default, it is enabled when data redundancy is supported. | ||||||||||||||||||
/TXF:<state> | [Windows 8 or later] Specifies whether to enable or disable Transactional NTFS (TxF). <state> will be either ‘enable’ or ‘disable’. | ||||||||||||||||||
/DAX[:<state>] | [Windows 10 or later] NTFS only: Specifies whether to enable or disable Direct Access Storage (DAX). <state> will be either ‘enable’ or ‘disable’. (If only ‘/DAX’ is specified, it is considered as ‘/DAX:enable’.) Enabling DAX improves performance by bypassing the cache for data read and write, but it increases the risk of data loss. Note that the drive's hardware must support DAX for it to be enabled. | ||||||||||||||||||
/LogSize:<size> |
[Windows 10 or later] NTFS only: Specifies the size of the NTFS log file. <size> will be a numeric value (in kilobytes). If a value smaller than 2048 (2MB) and not equal to 0 is specified, 2048 (2MB) will be used. If 0 is specified, the default value depending on the volume size will be used. * In the help, ‘<size>’ is indicated as optional, but in practice, it cannot be omitted. |
||||||||||||||||||
/NoRepairLogs | [Windows 10 or later] NTFS only: Disables the NTFS repair log. If disabled, the spotfix feature of Chkdsk cannot be used. | ||||||||||||||||||
/NoTrim | [Windows 8 or later] Disables the disk trim operation (an operation that releases data areas that were allocated when files, etc., were deleted). Normally, trim operations are enabled, and enabling them is advantageous for performance and lifespan, especially on SSDs. However, you can explicitly disable trim by specifying /NoTrim. | ||||||||||||||||||
/DevDrv | [Windows 11 10.0.22621.2338 or later] ReFS only: Formats as a ‘dev drive’. A ‘dev drive’ (or developer volume) is a volume optimized for performance in development. (For details, refer to Set up a Dev Drive on Windows 11 | Microsoft Learn and similar resources.) | ||||||||||||||||||
/Y | [Windows 11 ???? or later] Suppresses prompts for confirmation or input. When this option is used, it forcibly unmounts if necessary, and if /V is not specified, the volume label is treated as empty. |
Details
This command formats the drive, making it a blank slate. Be cautious when executing this command as formatting will erase previous contents. Note that typically, you cannot format the boot drive.
Format displays a confirmation message (excluding floppy disks) before formatting (unless specifying /Y). To proceed with formatting, enter ‘Y’; to cancel, enter ‘N’.
Format primarily returns the following exit codes, allowing for conditional branching using If.
Code | Meaning |
---|---|
0 | Format completed successfully. |
1 | Invalid command line. |
3 | The operation was aborted due to the input of Ctrl+C. |
5 | ‘No’ (N) was selected at the prompt asking, ‘Do you want to format another disk?’ |
4 | A fatal error occurred, not covered by the options above. |
Samples
Sample 1
format A: /S
[MS-DOS, Windows 95/98] Formats the disk in drive A: as a bootable disk.
Sample 2
format H: /FS:NTFS
[Windows NT series] Formats drive H: as NTFS.
Sample 3
format E: /FS:UDF /R:2.60
[Windows 7以降] Formats the CD/DVD/BD in drive E: as UDF version 2.60 (supported from Windows 7).