format(CMD) 19 June 1992 format(CMD) Name format - format the disk in the specified drive to accept MS-DOS files Syntax format drive: [/v[:label]] [/q] [/u] [/f:size] [/b|/s] format drive: [/v[:label]] [/q] [/u] [/t:tracks /n:sectors] [/b|/s] format drive: [/v[:label]] [/q] [/u] [/1] [/4] [/b|/s] format drive: [/q] [/u] [/1] [/4] [/8] [/b|/s] Description The format command creates a new root directory and file allocation table for the disk. It can also check for bad areas on the disk, and it can delete all data on the disk. In order for MS-DOS to be able to use a new disk, you must first use this command to format the disk. Parameter drive: Specifies the drive containing the disk you want to format. If you do not specify any of the following switches, format uses the drive type to determine the default format for the disk. Switches /v:label Specifies the volume label. A volume label identifies the disk and can be a maximum of 11 characters. If you omit the /v switch, or use it without specifying a volume label, MS-DOS prompts you for the volume label after the formatting is com- pleted. If you format more than one disk by using one format command, all of the disks will be given the same volume label. The /v switch is not compatible with the /8 switch. For more information about disk volume labels, see the dir(CMD), label(CMD), and vol(CMD) commands. /q Deletes the file allocation table (FAT) and the root directory of a previously formatted disk, but does not scan the disk for bad areas. You should use the /q switch to format only previ- ously formatted disks that you know are in good condition. /u Specifies an unconditional format operation for a floppy disk or hard disk. Unconditional formatting destroys all existing data on a disk and prevents you from later ``unformatting'' the disk. You should use /u if you have received read and write errors during use of the disk. For information about unformat- ting a disk, see the unformat(CMD) command. /f:size Specifies the size of the floppy disk to format. When possi- ble, use this switch instead of the /t and /n switches. Use one of the following values for size: 160 or 160k or 160kb 160K, single-sided, double-density, 5.25-inch disk 180 or 180k or 180kb 180K, single-sided, double-density, 5.25-inch disk 320 or 320k or 320kb 320K, double-sided, double-density, 5.25-inch disk 360 or 360k or 360kb 360K, double-sided, double-density, 5.25-inch disk 720 or 720k or 720kb 720K, double-sided, double-density, 3.5-inch disk 1200 or 1200k or 1200kb or 1.2 or 1.2m or 1.2mb 1.2-MB, double-sided, quadruple-density, 5.25-inch disk 1440 or 1440k or 1440kb or 1.44 or 1.44m or 1.44mb 1.44-MB, double-sided, quadruple-density, 3.5-inch disk 2880 or 2880k or 2880kb or 2.88 or 2.88m or 2.88mb 2.88-MB, double-sided, 3.5-inch disk /b Reserves space for the system files IO.SYS and MSDOS.SYS on a newly formatted disk (as hidden files). In previous versions of MS-DOS, it was necessary to reserve this space before using the sys command to copy the system files to the disk. This switch is maintained in MS-DOS version 5.0 for compatibility reasons only. /s Copies the operating system files IO.SYS, MSDOS.SYS, and COMMAND.COM from your system's startup drive to the newly for- matted disk. If format cannot find the operating system files, it prompts you to insert a system disk. /t:tracks Specifies the number of tracks on the disk. When possible, use the /f switch instead of this switch. If you use the /t switch, you must also use the /n switch. These two switches provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f switch with the /t switch. /n:sectors Specifies the number of sectors per track. When possible, use the /f switch instead of this switch. If you use the /n switch, you must also use the /t switch. These two switches provide an alternative method of specifying the size of the disk being formatted. You cannot use the /f switch with the /n switch. /1 Formats a single side of a floppy disk. /4 Formats a 5.25-inch, 360K, double-sided, double-density floppy disk on a 1.2-MB disk drive. Some 360K drives cannot reliably read disks formatted with this switch. When used with the /1 switch, this switch formats a 5.25-inch, 180K, single-sided floppy disk. /8 Formats a 5.25-inch disk with 8 sectors per track. This switch formats a floppy disk to be compatible with MS-DOS versions prior to 2.0. Notes Typing a volume label After formatting a floppy disk, format displays the following message: Volume label (11 characters, ENTER for none)? The volume label can be a maximum of 11 characters (including spaces). If you do not want your disk to have a volume label, just press Esc. For information about volume labels, see the label(CMD) command. Formatting a hard disk When you use the format command to format a hard disk, MS-DOS displays a message of the following form before attempting to format the hard disk: WARNING, ALL DATA ON NON-REMOVABLE DISK DRIVE x: WILL BE LOST! Proceed with Format (Y/N)?_ To format the hard disk, press Y; if you do not want to format the disk, press N. Format messages When formatting is complete, MS-DOS displays messages showing the total disk space, any space marked as defective, the total space used by the operating system (if you used the /s or /b switch), and the space avail- able for your files. Safe formatting If you do not specify the /u switch or a switch that reformats the disk to a different size, format performs a ``safe'' format, meaning that it clears the file allocation table and root directory of the disk but does not delete any data. You can then use the unformat command to recover the disk if you did not originally intend to format the disk. format also checks each sector on the disk to ensure that the sector can prop- erly store data. If it locates a sector that cannot store data, format marks that sector to prevent MS-DOS from using it. If you specify the /u switch or any switch that changes the size of the disk, format performs an unconditional format operation by deleting all data on the disk. Quick formatting You can speed up the formatting process by using the /q switch. Use this switch only if you have not received read or write errors on your hard disk. You can speed up the process even more by using both the /q and /u switches. If you use the /u switch, format does not save the information necessary to later unformat the disk. Formatting a new disk When you use format to format a disk that has never been formatted, specify the /u switch to minimize formatting time. Using format with a reassigned drive or a network drive You should not use the format command on a drive prepared by using the assign, join, or subst command. You cannot format disks over a network. Format exit codes The following list shows each exit code and a brief description of its meaning: 0 The format operation was successful. 3 The user pressed CtrlC to stop the process. 4 A fatal error occurred (any error other than 0, 3, or 5). 5 The user pressed N in response to the prompt ``Proceed with Format (Y/N)?'' to stop the process. You can check these exit codes by using the errorlevel condition with the if batch command. For an example of a batch program that supports error- level conditions, see the backup(CMD) command. Examples To format a new floppy disk in drive A, using the default size, type the following command: format a: To perform a quick format operation on a previously formatted disk in drive A, type the following command: format a: /q To format a floppy disk in drive A, completely deleting all data on the disk, type the following command: format a: /u To format a 360K floppy disk in drive A and copy the operating system to it, type the following command: format a: /f:360 /s To format a floppy disk in drive A and assign it the volume label ``DATA'', type the following command: format a: /v:DATA Related command For information about restoring disks after using the format command, see the unformat(CMD) command.