Rob van der Woude's Scripting Pages
BE CAREFUL: This machine has no brain, use your own

The FORMAT Command

Basic syntax:

FORMAT volume [ parameters ]

 

FORMAT Parameters
Parameter Function OS Remarks
volume Specifies the drive letter (followed by a colon), mount point, or volume name All  
/1 Format single sided (3) All Diskettes only
/4 Format 5¼" diskette at 360K (DS-DD) in 5¼" 1.2M (DS-HD) floppy drive (3) All In MS-DOS 5+, use /F:360 instead (diskettes only)
/8 Format 8 sectors per track (3) All Functionally equivalent to /N:8 (diskettes only)
/A:size Overrides the default allocation unit size. (3)
Default settings are strongly recommended for general use.
NTFS supports 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.
FAT and FAT32 support 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K, (128K, 256K for sector size > 512 bytes).

Note that the FAT and FAT32 files systems impose the following restrictions on the number of clusters on a volume:

FAT: Number of clusters <= 65526
FAT32: 65526 < Number of clusters < 268435446

Format will immediately stop processing if it decides that the above requirements cannot be met using the specified cluster size.

NTFS compression is not supported for allocation unit sizes above 4096.
Windows 2000+  
/AUTOTEST Format without user interaction MS-DOS 5 .. 7 Functionally equivalent to XP's /Y parameter.
Cannot be combined with /Q parameter
/B Reserve space to make disk bootable MS-DOS 7.*
(Windows 95/98)
 
/BACKUP Format (diskette only) without asking to insert diskette and without asking if you would like to format another diskette MS-DOS 3 .. 7
Windows NT4
Functionally equivalent to OS/2's /ONCE parameter.
Combined with the appropriate /F or /N and /T parameters and with /V:"" (specifies an empty volume label (1)) no user interaction is required at all.
/C Check clusters that are marked as "bad" MS-DOS 7.*
(Windows 95/98)
 
/C Files created on the new volume will be compressed by default Windows 2000+  
/D Metadata will be duplicated Vista+ UDF 2.50 only
/FS:filesystem Specify file system, e.g. FAT, FAT32, NTFS or HPFS OS/2 Warp
Windows NT4+
 
/L Unconditional or long format: performs a low level format on diskettes, checks sectors that were marked as "bad" OS/2 Warp Functionally equivalent to MS-DOS' /U parameter.
For OS/2 /L is default when formatting floppy disks, for harddisks /Q is default.
/N:sectors Specify number of sectors per track (3) All Diskettes only
/ONCE Format (diskette only) without asking to insert diskette and without asking if you would like to format another diskette OS/2 Warp Functionally equivalent to MS-DOS' /BACKUP parameter (1)
/P:passes Zero every sector on the volume passes times Vista+ Functionally more or less equivalent to MS-DOS' /U parameter or OS/2's /L parameter.
This switch is not valid with /Q
/Q Quick format (2) MS-DOS 5+
OS/2 Warp
Windows NT4+
/Q is default for MS-DOS 5+
For OS/2 /Q is default when formatting harddisks, for floppy disks /L is default
/R:revision Forces the format to a specific UDF version Vista+ revision values allowed: 1.02, 1.50, 2.00, 2.01 (default) or 2.50
/S Make disk bootable and copy system files MS-DOS 3 .. 7  
/S:state Enable/disable short names Windows 7 state is either "enable" or "disable".
Short names are enabled by default
/T:tracks Specify number of tracks (3) All Diskettes only
/U Unconditional format: performs a low level format on diskettes, checks sectors that were marked as "bad" (2) MS-DOS 5 .. 7
OS/2 Warp
Windows NT4
Functionally equivalent to OS/2's /L parameter or Windows 7/Vista's /P:1 parameter
/V[:label] Specify new volume label, ask for it if label is not specified (1) All /V without label specified is the default for MS-DOS 4+
/X Forces the volume to dismount first if necessary.
All opened handles to the volume would no longer be valid.
Windows 2000+  
/Y Format without user interaction Windows XP+ Functionally equivalent to MS-DOS' /AUTOTEST parameter.
Can be combined with /Q parameter
/Z:n Format FAT32 with cluster size set to n times 512 bytes MS-DOS 7.1
(Windows 98)
Hard disks > 512 MB only

 

Thanks for Ryan Scheffer who told me about the /Y parameter in Windows XP and later versions.

 

Notes: (1) In MS-DOS and Windows, /V:"" can be used to specify no label (actually an empty label).
In OS/2 you have to redirect an empty line to the FORMAT command if you don't want a label:
VER | FORMAT A: /ONCE ....
  (2) /Q, /U and user interaction in MS-DOS:
(Quoted from an alt.msdos.batch newsgroup posting by "Outsider")
If no sectors are marked "bad" use /Q or /Q /U
If sectors are marked "bad" use /C /U to retest bad clusters
No switches allows unformatting
The /Q switch allows unformatting
The /Q /U switches disallow unformatting; very fast
The /C switch doesn't work with the /Q switch
The /AUTOTEST switch skips user input, doesn't work with the /Q switch
  (3) Parameters for non-default formats (i.e. /1, /4, /8, /A, /N, /T) usually don't work on USB drives

page last modified: 2011-10-29; loaded in 0.0018 seconds