FC

Index

Compares two files or sets of files and displays the differences between them.

Syntax:

FC [/Switches] file1 file2

Switches:

/BPerforms a binary comparison.
The two files are compared byte by byte and there is no attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files when file1 has an extension of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.
/LCompares files as ASCII.
The two files are compared line by line and FC attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files when file1 does not have an extension of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.
/LBnSets the number of lines for the internal line buffer.
If the files being compared have more than this number of consecutive differing lines, FC cancels the comparison.
Default value of n: 100
/nnThe number of consecutive lines that must match before the files are declared resynchronized. If the number of matching lines in the files is less than this number, the matching lines are displayed as differences.
Default value of nn: 2.
/NDisplays the line numbers on an ASCII comparison.
/AAbbreviates the output of an ASCII comparison. Only the first and last line for each set of differences is displayed as opposed to the default of every different line.
/CDisregards the case of letters.
/TDoes not expand tabs to spaces.
By default, tabs are treated as spaces with 1 tab = 8 spaces.
/WCompresses tabs and multiple spaces to a single space for the comparison.

Notes:

  1. If file1 includes a wildcard, all applicable files are compared to file2.
    If file2 also includes a wildcard, it is compared with the corresponding file1.

  2. If FC can detect no differences between the two files being compared, the result is displayed as:

    C:\WINDOWS>fc c:\test1.txt c:\test2.txt
    Comparing files c:\test1.txt and c:\test2.txt
    FC: no differences encountered
     
    C:\WINDOWS>_

    If differences are found in ASCII mode, the last line that is the same in both files is displayed, followed by any lines that are different, and concluding with the next line that is the same.

    C:\WINDOWS>fc c:\test1.txt c:\test2.txt /n
    Comparing files c:\test1.txt and c:\test2.txt
    ****** c:\test1.txt
           4:  This is test fourth line
           5:  This is test fifth line
    ****** c:\test2.txt
           4:  This is test fourth line
           5:  This is an extra line
           6:  This is test fifth line
    ******
     
    C:\WINDOWS>_

    If differences are found in binary mode, no attempt at rematching is made. Instead, once a difference is found, the address is listed followed by the mismatching byte values of the two files:

    C:\WINDOWS>fc c:\test1.txt c:\test2.txt /b Comparing files c:\test1.txt and c:\test2.txt FFFFFFB0: 6E 23 FFFFFFB1: 65 6E FC: c:\test2.txt longer than c:\test1.txt C:\WINDOWS>_

    Here, the first difference in the files occurred at the B0th (176th) byte from the start of the files - where the first file had a byte value of 6E (n), the second had 23 (#).
    The B1th byte is also different.

  3. In most cases, binary files are compared to see if they are the same or not - knowing the details of exactly what the differences are is seldom useful to the casual user. To simply see if two binary files are identical, it is often quickest to compare them as ASCII files using the /LB1 switch to cut the output to a minimum.

    For an example of the significant differences in processing times, just try: FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe /L FC c:\windows\command\xcopy.exe c:\windows\command\attrib.exe /L /LB1

File Details

File NameDefault LocationDos Ver.Win Ver.SizeDateSource
Fc.exec:\windows\command 7.0Win95 20 49411/07/95win95_08.cab
7.1Win95 (OSR2.x) 20 574124/08/96win95_14.cab
Win98 20 574111/05/98win98_41.cab
Win98 SE 20 574123/04/99win98_45.cab

Superscripts denote which same size files, if any, are identical (using FC).


This page last revised:
October 17, 2000.