FC.exe – Windows CMD Command

Compare the contents of two files or sets of files. Display any lines which do NOT match.

Powershell also has an Alias FC for the Format-Custom cmdlet, therefore to run the ‘old’ FC under PowerShell you can explicitly run C:\windows\system32\fc.exe

Errorlevels

FC will set an ErrorLevel as follows:

-1 Invalid syntax (e.g. only one file passed)
0 The files are identical.
1 The files are different.
2 Cannot find at least one of the files.
For an invalid switch (with two passed files) an error message is printed but the errorlevel is not changed.

Comparison order

When FC is used for an ASCII comparison, it will display differences between two files in the following order:

  1. Name of the first file
  2. Lines from filename1 that differ between the files
  3. First-line to match in both files
  4. Name of the second file
  5. Lines from filename2 that differ
  6. First-line to match

Binary Comparisons

/B displays mismatches found during a binary comparison as follows: xxxxxxxx: yy zz

The value of xxxxxxxx specifies the relative hexadecimal address for the pair of bytes, measured from the beginning of the file. Addresses start at 00000000.
The hexadecimal values for yy and zz represent the mismatched bytes from filename1 and filename2, respectively.

When comparing binary files that are larger than available memory, FC compares both files completely, overlaying the portions in memory with the next portions from the disk.

PowerShell

Like every other external command, FC can be run under PowerShell instead of CMD, however, there is one extra complication for FC and that is the standard PowerShell alias FC which redirects to the Format-Custom cmdlet.

You may also like...

1 Response

  1. frolep rotrem says:

    Hello.This post was extremely remarkable, especially because I was browsing for thoughts on this topic last week.

Leave a Reply

Your email address will not be published. Required fields are marked *