Windows command line format command

Format Drive command

In Windows, we can format a disk drive using inbuilt command ‘format’ . What ever we can do in the disk management tool, we can do the same using format command. This article explains the different options available for the command.

Format a disk drive

When you execute this command, you will be asked to enter the current label of the drive(if it has a label) and also to confirm if you really want to format the drive. Accidentally running a format command would cause data loss. So be sure you are running the command on the right drive.

Example: Format the drive F: with NTFS filesystem and assign the label ‘Backup’

How to do Quick format

The above command may take several minutes depending on the size of the drive. If you want to quicky format the drive, you can use the option ‘/q’.

If you want to enable compression on the drive, you can do that by adding the option ‘/C‘. This can be done later also by opening the properties of the disk drive.

We can also configure the file system allocation unit size. For example, if you want to use 4096 bytes as one allocation unit, then you can run the below command.

Format command works on all Windows releases : XP, Server 2003, Vista, Windows 7 and Windows 8.

This command should be executed from elevated administrator command prompt. Otherwise, you would get the below error.

go to start/program/accessories/command prompt Steve Macha

How would I use the in-line disk format command and suppress all user interactivity? It seem that with Windows 10 the /y switch no longer works.

Looks like you need to use /x option to unmount the drive first which should suspend all user activity. I do not see /y in documentation or in help for the command.

Hi, if you’re still reading, the other trick, to push a ‘y’ at any CLI instruction that demands confirmation is ‘echo y | format XYZ’ the | character streams whatever the previous command outputs into the next command as if it were keyboard input.

i want to reinstall from disc after the f disc command how do ido that it inspiron ;laptop with xp pro

MS-DOS and Windows command line format command

The format command is used to erase information from a computer diskette or fixed drive.

Although the information appears to be erased, it is still possible for software recovery programs to recover information from a formatted drive. If you want to make sure no information can be recovered from a drive, use a software utility to make sure all data is erased and overwritten. See: How to make sure all data is erased on a computer hard drive.

Availability

Format is an external command that is available for the following Microsoft operating systems as format.com.

Format syntax

Windows Vista and later syntax

Overrides the default allocation unit size. Default settings
are strongly recommended for general use.
ReFS supports 64 K.
NTFS supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K.
FAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
exFAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, 128 K, 256 K, 512 K, 1 M, 2 M, 4 M, 8 M, 16 M, 32 M.

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

FAT: Number of clusters 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).

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

FAT: Number of clusters Caution

When using the format command, remember all the information on the drive you want to format will be completely erased.

Would erase all the contents off a floppy disk. Commonly used on an unformatted diskette, or one you want to erase.

Quickly erases all the contents of a floppy diskette. Commonly used to quickly erase all information on the diskette.

Erase the contents of your C: hard drive. In other words, unless you want to erase all your computer’s information, this command should not be executed unless you’re planning on starting over.

If you’re in Windows or files on the hard drive are in use, this command will not work. If you want to format the primary hard drive you’ll need to boot from a bootable diskette, restore disc, or another bootable drive.

Windows commands

All supported versions of Windows (server and client) have a set of Win32 console commands built in.

This set of documentation describes the Windows Commands you can use to automate tasks by using scripts or scripting tools.

Prerequisites

The information that is contained in this topic applies to:

  • Windows Server 2019
  • Windows Server (Semi-Annual Channel)
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2012
  • Windows Server 2008 R2
  • Windows Server 2008
  • Windows 10
  • Windows 8.1

Command shell overview

The Command shell was the first shell built into Windows to automate routine tasks, like user account management or nightly backups, with batch (.bat) files. With Windows Script Host you could run more sophisticated scripts in the Command shell. For more information, see cscript or wscript. You can perform operations more efficiently by using scripts than you can by using the user interface. Scripts accept all Commands that are available at the command line.

Windows has two command shells: The Command shell and PowerShell. Each shell is a software program that provides direct communication between you and the operating system or application, providing an environment to automate IT operations.

PowerShell was designed to extend the capabilities of the Command shell to run PowerShell commands called cmdlets. Cmdlets are similar to Windows Commands but provide a more extensible scripting language. You can run Windows Commands and PowerShell cmdlets in Powershell, but the Command shell can only run Windows Commands and not PowerShell cmdlets.

For the most robust, up-to-date Windows automation, we recommend using PowerShell instead of Windows Commands or Windows Script Host for Windows automation.

You can also download and install PowerShell Core, the open source version of PowerShell.

Incorrectly editing the registry may severely damage your system. Before making the following changes to the registry, you should back up any valued data on the computer.

To enable or disable file and directory name completion in the Command shell on a computer or user logon session, run regedit.exe and set the following reg_DWOrd value:

To set the reg_DWOrd value, use the hexadecimal value of a control character for a particular function (for example, 0 9 is Tab and 0 08 is Backspace). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.

Command-line reference A-Z

To find information about a specific command, in the following A-Z menu, click the letter that the command starts with, and then click the command name.

Формат Format

Область применения: Windows 10, Windows Server 2016 Applies to: Windows 10, Windows Server 2016

Форматирует диск для приема файлов Windows. Formats a disk to accept Windows files. Для форматирования жесткого диска необходимо быть членом группы администраторов. You must be a member of the Administrators group to format a hard drive.

В консоли восстановления можно также использовать команду Format с различными параметрами. You can also use the format command, with different parameters, from the Recovery Console. Дополнительные сведения о консоли восстановления см. в разделе Среда восстановления Windows (Windows RE). For more information about the recovery console, see Windows Recovery Environment (Windows RE).

Синтаксис Syntax

Параметры Parameters

volume Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:filesystem Specifies the file system (FAT, FAT32, exFAT, NTFS, UDF, ReFS).
/V:label Specifies the volume label.
/Q Performs a quick format. Note that this switch overrides /P.
/C NTFS only: Files created on the new volume will be compressed by default.
/X Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/R:revision UDF only: Forces the format to a specific UDF version (1.02, 1.50, 2.00, 2.01, 2.50). The default revision is 2.01.
/D UDF 2.50 only: Metadata will be duplicated.
/L NTFS Only: Use large size file records. By default, the volume will be formatted with small size file records.
/A:size
Параметр Parameter Описание Description
Указывает точку подключения, имя тома или букву диска (с последующим двоеточием) диска, который требуется отформатировать. Specifies the mount point, volume name, or drive letter (followed by a colon) of the drive that you want to format. Если не указать ни один из следующих параметров командной строки, команда Format использует тип тома для определения формата диска по умолчанию. If you do not specify any of the following command-line options, format uses the volume type to determine the default format for the disk.
/FS: /fs: Указывает тип файловой системы (FAT, FAT32, NTFS). Specifies the type of file system (FAT, FAT32, NTFS).
/v: /v: Задает метку тома. Specifies the volume label. Если опустить параметр командной строки /v или использовать его без указания метки тома, будет предложено ввести метку тома после завершения форматирования. If you omit the /v command-line option or use it without specifying a volume label, format prompts you for the volume label after the formatting is complete. Введите параметр с синтаксисом /v:, чтобы запрос на ввод метки тома не появлялся. Use the syntax /v: to prevent the prompt for a volume label. Если вы форматируете несколько дисков одной командой format, всем дискам будет присвоена одинаковая метка тома. If you use a single format command to format more than one disk, all of the disks will be given the same volume label.
/ /a: Указывает размер единицы размещения для томов FAT, FAT32 или NTFS. Specifies the allocation unit size to use on FAT, FAT32, or NTFS volumes. Если не указать унитсизе, он будет выбран в зависимости от размера тома. If you don’t specify unitsize, it’s chosen based on volume size. Для общего использования настоятельно рекомендуется применять параметры по умолчанию. Default settings are strongly recommended for general use. В следующем списке представлены допустимые значения для NTFS, FAT и FAT32 унитсизе: The following list presents valid values for NTFS, FAT, and FAT32 unitsize:
  • 512 512
  • 1024 1024
  • 2048 2048
  • 4096 4096
  • 8192 8192
  • 16K 16K
  • 32 КБ 32K
  • 64K 64K

Файловые системы FAT и FAT32 также поддерживают значения 128 KБ и 256 KБ для секторов размером больше 512 байт. FAT and FAT32 also support 128K and 256K for a sector size greater than 512 bytes.

/q /q Выполняет быстрое форматирование. Performs a quick format. Удаляет файловую таблицу и корневой каталог ранее отформатированного тома, но не выполняет посекторную проверку на наличие плохих областей. Deletes the file table and the root directory of a previously formatted volume, but does not perform a sector-by-sector scan for bad areas. Параметр командной строки /q следует использовать для форматирования только ранее отформатированных томов, о которых известно, что они имеют хорошее состояние. You should use the /q command-line option to format only previously formatted volumes that you know are in good condition. Обратите внимание, что /q переопределяет /p. Note that /q overrides /p.
ключа /f: Задает размер форматируемого гибкого диска. Specifies the size of the floppy disk to format. По возможности используйте этот параметр командной строки вместо параметров командной строки /t и /n . When possible, use this command-line option instead of the /t and /n command-line options. В Windows допустимыми являются следующие значения размера: Windows accepts the following values for size:

  • 1440 или 1440k или 1440kb 1440 or 1440k or 1440kb
  • 1,44, 1,44 или 1,44 МБ 1.44 or 1.44m or 1.44mb
  • 1,44 – МБ, двойная, Четверная плотность, 3,5-дюймовый диск 1.44-MB, double-sided, quadruple-density, 3.5-inch disk
/t:/t: Задает количество дорожек на диске. Specifies the number of tracks on the disk. По возможности используйте параметр командной строки /f . When possible, use the /f command-line option instead. Параметр /t должен использоваться только вместе с параметром /n. If you use the /t option, you must also use the /n option. Эти параметры применяются совместно в качестве альтернативного способа указания размера форматируемого диска. These options together provide an alternative method of specifying the size of the disk that is being formatted. Этот параметр не работает с параметром /f. This option is not valid with the /f option.
параметра /n: Указывает количество секторов на дорожке. По возможности используйте параметр командной строки /f вместо /n. Specifies the number of sectors per track. When possible, use the /f command-line option instead of /n. Параметр /n должен использоваться только вместе с параметром /t. If you use /n, you must also use /t. Эти параметры применяются совместно в качестве альтернативного способа указания размера форматируемого диска. These two options together provide an alternative method of specifying the size of the disk that is being formatted. Этот параметр не работает с параметром /f. This option is not valid with the /f option.
/p

Обнуляет каждый сектор тома указанное количество раз. Zeros every sector on the volume for the number of passes specified. Этот параметр не работает с параметром /q. This option is not valid with the /q option. /C /c Только NTFS. NTFS only. Файлы, создаваемые в новом томе, будут сжиматься по умолчанию. Files created on the new volume will be compressed by default. /x /x Приводит к отключению тома (при необходимости) до его форматирования. Causes the volume to dismount, if necessary, before it’s formatted. Все открытые дескрипторы тома становятся недействительными. Any open handles to the volume will no longer be valid. /? /? Отображение справки в командной строке. Displays help at the command prompt.

Remarks Remarks

Команда Format создает новый корневой каталог и файловую систему для диска. The format command creates a new root directory and file system for the disk. Кроме того, он может проверить наличие поврежденных областей на диске и удалить все данные на диске. It can also check for bad areas on the disk, and it can delete all data on the disk. Чтобы иметь возможность использовать новый диск, необходимо сначала использовать эту команду для форматирования диска. To be able to use a new disk, you must first use this command to format the disk.

После форматирования дискеты в формате отображается следующее сообщение: After formatting a floppy disk, format displays the following message:

Volume label (11 characters, ENTER for none)?

Чтобы добавить метку тома, введите до 11 символов (включая пробелы). To add a volume label, type up to 11 characters (including spaces). Если вы не хотите добавлять метку тома на диск, нажмите клавишу ВВОД. If you do not want to add a volume label to the disk, press ENTER.

При использовании команды Format для форматирования жесткого диска выводится предупреждение следующего вида: When you use the format command to format a hard disk, a warning message similar to the following displays:

Чтобы отформатировать жесткий диск, нажмите клавишу Y; Если вы не хотите форматировать диск, нажмите клавишу N. To format the hard disk, press Y; if you do not want to format the disk, press N.

Файловые системы FAT ограничивают количество кластеров не более 65526. FAT file systems restrict the number of clusters to no more than 65526. Файловые системы FAT32 ограничивают количество кластеров между 65527 и 4177917. FAT32 file systems restrict the number of clusters to between 65527 and 4177917.

Сжатие томов NTFS не поддерживается для кластеров размером более 4 МБ. NTFS compression is not supported for allocation unit sizes above 4096.

Параметр Format немедленно останавливает обработку, если он определяет, что предыдущие требования не могут быть выполнены с использованием указанного размера кластера. Format will immediately stop processing if it determines that the previous requirements can’t be met using the specified cluster size.

После завершения форматирования в поле Формат отображаются сообщения, отображающие общее место на диске, пробелы, отмеченные как неисправные, и место, доступное для файлов. When formatting is complete, format displays messages that show the total disk space, the spaces marked as defective, and the space available for your files.

Ускорить процесс форматирования можно с помощью параметра командной строки /q . You can speed up the formatting process by using the /q command-line option. Используйте этот параметр, только если на жестком диске нет поврежденных секторов. Use this option only if there are no bad sectors on your hard disk.

Не следует использовать команду Format на диске, подготовленном с помощью команды subst . You shouldn’t use the format command on a drive that was prepared by using the subst command. Вы не можете отформатировать диски по сети. You can’t format disks over a network.

В следующей таблице перечислены коды завершения и краткое описание каждого из них. The following table lists each exit code and a brief description of its meaning.

Код выхода Exit code Описание Description
0 0 Форматирование выполнено успешно. The format operation was successful.
1 1 Заданы недопустимые параметры. Incorrect parameters were supplied.
4 4 Произошла неустранимая ошибка (любая ошибка, отличная от 0, 1 или 5). A fatal error occurred (which is any error other than 0, 1, or 5).
5 5 Пользователь нажал N в ответ на запрос «продолжить форматирование (Y/N)?» The user pressed N in response to the prompt «Proceed with Format (Y/N)?» чтобы завершить процесс. to stop the process.

Коды завершения можно проверить с помощью переменной среды errorlevel в пакетной команде if. You can check these exit codes by using the ERRORLEVEL environment variable with the if batch command.

Примеры Examples

Чтобы отформатировать новый гибкий диск в дисководе A с использованием размера по умолчанию, введите следующую команду. To format a new floppy disk in drive A using the default size, type:

Для быстрого форматирования ранее отформатированного гибкого диска в дисководе A введите следующую команду. To perform a quick format operation on a previously formatted floppy disk in drive A, type:

Чтобы отформатировать гибкий диск в дисководе а и назначить ему данные метки тома, введите: To format a floppy disk in drive A and assign it the volume label DATA, type:

Читайте также:  Руководство по ксз астра линукс часть 2
Оцените статью