Fc command in Windows

The fc command compares two files or a collection of files and displays the differences between them. For an example of how to use this command, please see the example below.

Command syntax fc

 fc /a [/c] [/l] [/lb] [/n] [/off[line]] [/t] [/u] [/w] [/] [:][] [:][] fc /b [][] [][] 

Parameters

Parameter Description / a Abbreviated output of ASCII comparison. Instead of displaying all the different lines, the fc command only displays the first line and finally gives each set a difference. / b Compare two files in binary mode, one byte at a time and do not attempt to re-synchronize the files after finding any differences. Files with the following extensions will be compared by default: .exe, .com, .sys, .obj, .lib, or .bin. / c Ignore the uppercase or lowercase letters. / l Compare files in ASCII mode, line by line and try to synchronize files after finding differences. This is the default mode for comparing files, except for files with the following extensions: .exe, .com, .sys, .obj, .lib, or .bin. / lb Set the number of lines for the line inside the buffet is N. The default length of the buffet is usually 100 lines. If the files you are comparing have more than 100 different rows in a row, then the fc command will cancel the comparison. / n Displays the line number while comparing ASCII. / off [line] Do not ignore files with offline properties set. / t Prevent the fc command from converting tabs into spaces. The default behavior is to handle tabs as spaces, with stops at the eighth character position. / u Compare files as Unicode text files. / w Compression of spaces (ie tabs and spaces) in comparison. If a line contains multiple spaces or consecutive tabs, / w considers these characters a space. When used with / w, the fc command ignores spaces at the beginning and end of a line. / Specifying the number of consecutive lines must match the following nonconformities, before the fc command considers the files to be re-synchronized. If the number of matching lines in the files is smaller than the NNNN, the command fc will display the appropriate lines as differences. The default value is 2. [:] [] Specifies the location and name of the first file or set of files to compare. FileName1 is required. [:] [] Specify the location and name of the second file or set of files to compare. FileName2 is required. /? Show help at the command prompt.

Note

  1. This command is executed by c: WINDOWSfc.exe. You can use this command in PowerShell, but be sure to write the full executable file name (fc.exe) because 'fc' is an acronym for Format-Custom.
  2. Report the differences between files for ASCII comparison: When you use the fc command to compare ASCII, fc displays the difference between the two files in the following order:
    1. The name of the first file
    2. Lines differ between files from FileName1
    3. The first line matches both files
    4. The name of the second file
    5. Lines differ between files from FileName2
    6. First line matches
  3. Use / b for binary comparison

/ b shows the differences found while comparing binary according to the following syntax:

 

The value of XXXXXXXX indicates a relative hexadecimal address for byte pairs, calculated from the beginning of the file. The address starts at 00000000. The hexadecimal values ​​for YY and ZZ represent the bytes that do not match from FileName1 and FileName2, respectively.

  1. Use wildcards

You can use wildcards ( * and ? ) In FileName1 and FileName2. If you use a wildcard in FileName1, fc compares all the specified files to the file or set of files specified by FileName2. If you use a wildcard in FileName2, fc uses the corresponding value from FileName1.

  1. Working with memory

When comparing ASCII files, fc uses internal buffers (big enough to hold up to 100 lines) as memory. If the file is larger than the buffet, fc will compare what it can load into the buffet. If fc does not find a match in the loaded parts of the file, it will stop and display the following message:

 Resynch failed. Files are too different. 

When comparing binary files larger than the available memory, fc compares both files completely, superimposing memory parts onto sequences from the drive. The output is the same as the output for the files to fit perfectly in memory.

For example

For ASCII comparisons of two text files, Monthly.rpt and Sales.rpt, and display the results in an abbreviated format, enter:

 fc /a monthly.rpt sales.rpt 

To compare binary files of batch, Profits.bat and Earnings.bat, enter:

 fc /b profits.bat earnings.bat 

The results are similar to the following:

 00000002: 72 43 00000004: 65 3A 0000000E: 56 92 . . . 000005E8: 00 6E FC: Earnings.bat longer than Profits.bat 

If Profits.bat and Earnings.bat files are identical, fc displays the following message:

 Comparing files Profits.bat and Earnings.bat FC: no differences encountered 

To compare all .bat files in the current directory with the New.bat file, enter:

 fc *.bat new.bat 

To compare the New.bat file on drive C with the New.bat file on drive D, enter:

 fc c:new.bat d:*.bat 

To compare each batch file in the root directory on drive C with the file with the same name in the root directory on drive D, enter:

 fc c:*.bat d:*.bat 

See more:

  1. Fondue command in Windows
  2. Forfiles command in Windows
  3. Ftype command in Windows
3.9 ★ | 24 Vote

May be interested

  • Instructions for using Command PromptInstructions for using Command Prompt
    deep in windows is a command-line world that is obscure. in this article, we will show you how to solve errors and make your computer more secure.
  • Rd command in WindowsRd command in Windows
    the rd command helps delete a directory
  • Cmd command in WindowsCmd command in Windows
    the cmd command starts a new version of the command interpreter, cmd.exe. if used without parameters, cmd will display copyright information and the version of the operating system.
  • How to use the command history function in Command PromptHow to use the command history function in Command Prompt
    command prompt is an extremely familiar command for anyone using windows operating system. besides, a lot of current software also supports the command line to perform actions on the command prompt window, instead of on the screen.
  • The sfc command in WindowsThe sfc command in Windows
    (applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012)
  • Reg command copy in WindowsReg command copy in Windows
    to copy an entry to the location specified on the local pc or the remote computer we will use the reg copy command. to learn more about how to use the reg copy command, you can track the syntax, explain the command parameters and the example tipsmake.com has compiled below.
  • The echo command in WindowsThe echo command in Windows
    the echo command displays the message or turns on / off the command repeat feature. if used without parameters, the echo command will display the current echo setting.
  • Xcopy command in WindowsXcopy command in Windows
    the xcopy command is a command prompt command used to copy one or more files or folders from one location to another. with many options and the ability to copy entire directories, the xcopy command is similar to, but much more powerful, than the copy command.
  • The cacls command in WindowsThe cacls command in Windows
    the cacls command displays or modifies an arbitrary access control list (dacl) on the specified file. the command applies to windows server (semi-annual channel), windows server 2016, windows server 2012 r2, windows server 2012.
  • Clean command in WindowsClean command in Windows
    the clean command deletes all partitions or formats the volume from the current drive. the command applies to windows server (semi-annual channel), windows server 2019, windows server 2016, windows server 2012 r2, windows server 2012.