FC
Compares two files and displays the differences between them.
Syntax
Parameters
Remarks
- Reporting differences between files for an ASCII comparison
When you use fc for an ASCII comparison, fc displays differences between two files in the following order:
- Name of the first file
- Lines from FileName1 that differ between the files
- First line to match in both files
- Name of the second file
- Lines from FileName2 that differ
- First line to match
-
Using /b for 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.
- Using wildcards
You can use wildcards (that is, * and ?) in FileName1 and FileName2. If you use a wildcard in FileName1, fc compares all the specified files to the file specified by FileName. If you use a wildcard in FileName2, fc uses the corresponding value from FileName1.
- Working with memory
When comparing ASCII files, fc uses an internal buffer (large enough to hold 100 lines) as storage. If the files are larger than the buffer, fc compares what it can load into the buffer. If fc does not find a match in the loaded portions of the files, it stops and displays the following message:
Resynch failed. Files are too different.
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. The output is the same as that for files that fit completely in memory.
Examples
fc /a monthly.rpt sales.rpt
To make a binary comparison of two batch files named Profits.bat and Earnings.bat, type:
fc /b profits.bat earnings.bat
The results similar to the following appear:
00000002: 72 43 00000004: 65 3A 0000000E: 56 92 00000012: 6D 5C 00000013: 0D 7C 00000014: 0D 0A 00000015: 0A 0D 0000001E: 43 7A 0000001F: 09 0A 00000022: 72 44 ... ... ... 000005E0: 00 61 000005E1: 00 73 000005E2: 00 73 000005E3: 00 69 000005E4: 00 67 000005E5: 00 6E 000005E6: 00 6D 000005E7: 00 65 000005E8: 00 6E FC: Earnings.bat longer than Profits.bat
If the Profits.bat and Earnings.bat files are identical, fc displays the following message:
FC: no differences encountered
To compare every .bat file in the current directory with the file New.bat, type:
fc *.bat new.bat
To compare the file New.bat on drive C with the file New.bat on drive D, type:
fc c:new.bat d:*.bat
To compare each batch file in the root directory on drive C to the file with the same name in the root directory on drive D, type:
fc c:*.bat d:*.bat
Formatting legend
Format | Meaning |
Italic | Information that the user must supply |
Bold | Elements that the user must type exactly as shown |
Ellipsis (...) | Parameter that can be repeated several times in a command line |
Between brackets ([]) | Optional items |
Between braces ({}); choices separated by pipe (|). Example: {even|odd} | Set of choices from which the user must choose only one |
Courier font | Code or program output |