• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
File Compare (fc) \windows\system32\fc.exe

Compare the contents two files (or sets of files) line by line and display the differences between them.

To Open

Command Prompt fc


fc file1 file2 [/a] [/c] [/lbn] [/n] [/t] [/w] [/offline] [/nnn] 
fc /b filename1 filename2


File Compare (fc.exe) compares the contents of two files (or more, using wildcards) and displays the differences (if any). If the files are identical, fc.exe will report FC: no differences encountered. If the files are different, fc.exe lists the differing lines. Here’s an example of how fc.exe is used:

Start with an ordinary text file, say, Bill.txt. Open it in Notepad, change one line, and save it into a new filename, say, Marty.txt. Then open a command prompt window, make sure you’re in the same directory as the two files, and type the following:

fc bill.txt marty.txt

The output will look something like this:

Comparing files Bill.txt and Marty.txt
***** Bill.txt
Way down Louisiana close to New Orleans
Way back up in the woods among the evergreens
There stood a log cabin made of earth and wood
***** Marty.txt
Way down Louisiana close to New Orleans
Way back up in the woods among the antihistamines
There stood a log cabin made of earth and wood

For each line or sequence of lines that is found to differ in the two files, fc.exe prints out a pair of excerpts from each of the files. The first and last line in each excerpt are what the two files have in common and are included for context. The lines in between (only a single line in this example) show the differences. The report will include one pair of excerpts for each difference found; if there are three nonconsecutive differing lines, there will be six excerpts. Here are the options for fc.exe:

file1, file2

Specify the filenames of the files to compare. For any files that aren’t in the current directory, you’ll need to include the full path. If file1 includes a wildcard, all matching files are compared to file2. Likewise, if file2 includes a wildcard, each matching file is compared to file1. Both parameters are required.


Display only first and last lines for each set of differences, as opposed to the default of every different line. This option is only applicable if a single sequence of differing lines (resulting in a single excerpt pair) is three lines or longer; otherwise, /a has no effect.


Disregards the case of ASCII characters; upper- and lowercase letters are treated as identical.

/lb n

Specify the maximum consecutive mismatches; /lb17 will list only the first 17 differing lines. If omitted, the default is 100 maximum mismatches.


Include line numbers in the report.


Preserve any tabs in the files being compared. By default, tabs are treated as spaces with 1 tab = 8 spaces.


Compress whitespace (tabs and spaces) to a single space for comparison. Possibly useful when comparing .html files, as web browsers will eliminate redundant tabs in spaces as well.


fc.exe normally skips files marked as “offline.” Specify /offline (or simply /off) to include offline files as well. (See “Synchronization Manager”, later in this chapter, for more information on offline files.)


Specify the number of consecutive lines that must match after a mismatch. For example, if you specify /4, a mismatched line followed by three matching lines, followed by one or more mismatched lines, is treated as though it were a single sequence of mismatched lines in the report.


Treat the files as ASCII (plain text). Since /l is the default, it has no effect.


Treat the files as unicode text.


Treat the files as binary and perform the comparison on a byte-by-byte basis (similar to comp.exe, the other file comparison utility). Instead of the pairs of excerpts explained above, differing bytes are displayed in parallel columns. A binary comparison is typically only appropriate for files of the same sizes, but unlike comp.exe, the comparison will still be performed if they are different sizes. The /b option can’t be used in conjunction with any of the other options.


  • Windows XP actually comes with two file comparison utilities, comp.exe (discussed in the previous section) and fc.exe (this one). comp.exe performs a character-by-character comparison, but only displays differences if the files are exactly the same size. fc.exe performs a line-by-line comparison and works regardless of the file sizes. For most users, fc.exe will be the tool of choice, as it displays the differences between the files and doesn’t have any prompts, so it can be used from a WSH script or batch file.

  • fc.exe is most useful when comparing two different, but similar, text files. For example, you can compare two Registry patches (since .reg files are plain text files) made at two different times to see what changes have been made. See Chapter 8 for more information on Registry Patches.

  • Although fc.exe can compare two binary files, if you try to compare two word processor documents (.doc and .wpd files are binary files), the results won’t be terribly helpful. Try converting the documents to an ASCII-based format, such as .rtf or .html, and then perform an ASCII comparison. Naturally, most modern word processors have their own document comparison tools, but they can often be limited; while word processors may miss subtle formatting changes, fc.exe will catch every singl e difference.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint