Compares two files or sets of files and displays the differences between them.
Syntax:
FC [/Switches] file1 file2
Switches:
/B | Performs 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. |
/L | Compares 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. |
/LBn | Sets 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 |
/nn | The 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. |
/N | Displays the line numbers on an ASCII comparison. |
/A | Abbreviates 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. |
/C | Disregards the case of letters. |
/T | Does not expand tabs to spaces.
By default, tabs are treated as spaces with 1 tab = 8 spaces. |
/W | Compresses tabs and multiple spaces to a single space for the comparison. |
Notes:
- 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.
- 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.
- 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 Name | Default Location | Dos Ver. | Win Ver. | Size | Date | Source |
Fc.exe | c:\windows\command |
7.0 | Win95 |
20 494 | 11/07/95 | win95_08.cab |
7.1 | Win95 (OSR2.x) |
20 5741 | 24/08/96 | win95_14.cab |
Win98 |
20 5741 | 11/05/98 | win98_41.cab |
Win98 SE |
20 5741 | 23/04/99 | win98_45.cab |
Superscripts denote which same size files, if any, are identical (using FC).
|