text stringlengths 0 4.23k |
|---|
Examples |
To list all of the batch files on drive C, type: |
forfiles /P c:\ /S /M *.bat /C "cmd /c echo @file is a batch file" |
To list all of the directories on drive C, type: |
forfiles /P c:\ /S /M * /C "cmd /c if @isdir==TRUE echo @file is a directory" |
To list all of the files in the current directory that are at least one year old, type: |
forfiles /S /M *.* /D -365 /C "cmd /c echo @file is at least one year old." |
To display the text file is outdated for each of the files in the current directory that are older than January 1, 2007, type: |
forfiles /S /M *.* /D -01/01/2007 /C "cmd /c echo @file is outdated." |
To list the file name extensions of all the files in the current directory in column format, and add a tab before the extension, type: |
forfiles /S /M *.* /C "cmd /c echo The extension of @file is 0x09@ext" |
Format |
Applies to: Windows Server 2022, Windows 10, Windows Server 2019 |
The format command formats a drive to accept Windows files. You must be a member of the Administrators group to format a hard drive. |
Note |
You can also use the format command, with different parameters, from the Recovery Console. For more information about the Recovery Console, see Windows Recovery Environment (Windows RE). |
Syntax |
format volume [/FS:file-system] [/V:label] [/Q] [/L[:state]] [/A:size] [/C] [/I:state] [/X] [/P:passes] [/S:state] |
format volume [/V:label] [/Q] [/F:size] [/P:passes] |
format volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes] |
format volume [/V:label] [/Q] [/P:passes] |
format volume [/Q] |
Parameters |
Parameter |
Description |
<volume> |
Specifies the mount point, volume name, or drive letter (followed by a colon) of the drive that you want to format. If you don't specify any of the following command-line options, format uses the volume type to determine the default format for the disk. |
/FS:<filesystem> |
Specifies the type of file system (FAT, FAT32, NTFS, exFAT, ReFS, or UDF). |
/V:<label> |
Specifies the volume label. 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. Use the syntax /V: to prevent the prompt for a volume label. If you use a single format command to format more than one disk, all of the disks are given the same volume label. |
/A:<size> |
Specifies the allocation unit size to use on FAT, FAT32, NTFS, exFAT, or ReFS volumes. If you don't specify unit size, it's chosen based on volume size. Default settings are recommended for general use. The following list presents valid values for each type of file system unit size:FAT and FAT32: 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K. Also 128K and 256K for a sector size greater than 512 bytes.NTFS: 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K, 128K, 256K, 512K, 1M, 2MexFAT: 12, 1024, 2048, 4096, 8192, 16K, 32K, 64K, 128K, 256K, 512K, 1M, 2M, 4M, 8M, 16M, 32MReFS: 4096, 64K |
/Q |
Performs a quick format. Deletes the file table and the root directory of a previously formatted volume, but doesn't perform a sector-by-sector scan for bad areas. You should use the /Q command-line option to format only previously formatted volumes that you know are in good condition. Note that /Q overrides /Q. |
/F:<size> |
Specifies the size of the floppy disk to format. When possible, use this command-line option instead of the /T and /T command-line options. Windows accepts the following values for size:1440 or 1440k or 1440kb1.44 or 1.44m or 1.44mb1.44-MB, double-sided, quadruple-density, 3.5-inch disk |
/T:<tracks> |
Specifies the number of tracks on the disk. When possible, use the /F command-line option instead. 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's being formatted. This option isn't valid with the /F option. |
/N:<sectors> |
Specifies the number of sectors per track. When possible, use the /F command-line option instead of /N. 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's being formatted. This option isn't valid with the /F option. |
/P:<count> |
Zero every sector on the volume. After that, the volume will be overwritten count times using a different random number each time. If count is zero, no other overwrites are made after zeroing every sector. This switch is ignored when /Q is specified. |
/C |
NTFS only. Files created on the new volume are compressed by default. |
/X |
Forces the volume to dismount, if necessary, before it's formatted. Any open handles to the volume are no longer be valid. |
/R |
NTFS only. Files created on the new volume are compressed by default. |
/D |
UDF 2.50 only. Metadata is duplicated. |
/L:<state> |
NTFS only. Overrides the default size of file record. By default, a nontiered volume is formatted with small size file records and a tiered volume is formatted with large size file records. /L and /L:enable forces format to use large size file records and /L:disable forces format to use small size file records. |
/S:<state> |
Specifies support for short filenames. State is either enable or disable. Short names are disabled by default. |
/TXF:<state> |
Specifies TxF is enabled/disabled. State is either enable or disable. TxF is enabled by default |
/I:<state> |
ReFS only. Specifies whether integrity should be enabled on the new volume. State is either enable or disable. Integrity is enabled on storage that supports data redundancy by default. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.