Sideway
output.to from Sideway
Draft for Information Only

Content

MS DOS Command: FC.EXE
 Description
 Syntax
 Parameters
 Switches
 Remarks
  Reporting differences between files for an ASCII comparison
  Using the /B switch for binary comparisons
  Using wildcards
  How FC uses memory
  Resynch failed. Files are too different.
 Examples

MS DOS Command: FC.EXE

Reference from Microsoft MS-DOS cmd help

Description

Compares two files and displays the differences between them.

Syntax

To make an ASCII comparison, use the following syntax:

FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn][drive1:][path1]filename1 [drive2:][path2]filename2

To make a binary comparison, use the following syntax:

FC /B [drive1:][path1]filename1 [drive2:][path2]filename2

Parameters

[drive1:][path1]filename1 Specifies the location and name of the first file you want to compare.
[drive2:][path2]filename2 Specifies the location and name of the second file you want to compare.

Switches

/A Abbreviates the output of an ASCII comparison. Instead of displaying all the lines that are different, FC displays only the first and last line for each set of differences.
/C Ignores the case of letters.
/L Compares the files in ASCII mode. FC compares the two files line by line and attempts to resynchronize the files after finding a mismatch. This is the default mode for comparing files that do not have extensions of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.
/LBn Sets the number of lines for the internal line buffer. The default length of the line buffer is 100 lines. If the files being compared have more than this number of consecutive differing lines, FC cancels the comparison.
/N Displays the line numbers during an ASCII comparison.
/T Does not expand tabs to spaces. The default behavior is to treat tabs as spaces, with stops at each eighth character position.
/W Compresses white space (tabs and spaces) during the comparison. If a line contains many consecutive spaces or tabs, the /W switch treats these characters as a single space. When used with the /W switch, FC ignores (and does not compare) white space at the beginning and end of a line.
/nnnn Specifies the number of consecutive lines that must match before FC considers the files to be resynchronized. If the number of matching lines in the files is less than this number, FC displays the matching lines as differences. The default value is 2.
/B Compares the files in binary mode. FC compares the two files byte by byte and does not attempt to resynchronize the files after finding a mismatch. This is the default mode for comparing files that have extensions of .EXE, .COM, .SYS, .OBJ, .LIB, or .BIN.

Remarks

Reporting differences between files for an ASCII comparison

When you use FC for an ASCII comparison, MS-DOS reports differences between two files by displaying the name of the first file, followed by the last line to match in both files, followed by the lines from filename1 that differ between the files, followed by the first line to match in both files. MS-DOS then displays the name of the second file, followed by the last line to match, followed by the lines from filename 2 that differ, followed by the next line to match.

Using the /B switch for binary comparisons

MS-DOS uses the following format to report mismatches found during a binary comparison:

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 (* and ?) in either of the filenames you specify with the FC command. If you use a wildcard in filename1, FC compares all the specified files to the file specified by filename2. If you use a wildcard in filename2, FC uses the corresponding value from filename1.

How FC uses 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

Either of the following commands changes your current directory to the directory named PRIMETIM:

Suppose you want to make an ASCII comparison of two text files that are named MONTHLY.RPT and SALES.RPT, and you want to display the results in abbreviated format. To make this comparison, type the following command:

fc /a monthly.rpt sales.rpt

To make a binary comparison of two batch files named PROFITS.BAT and EARNINGS.BAT, type the following command:

fc /b profits.bat earnings.bat

The results of this command will be similar to the following:

  • 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 were identical, FC would display the following message:

FC: no differences encountered

To compare every .BAT file in the current directory with the file NEW.BAT, type the following command:

fc *.bat new.bat

To compare the file NEW.BAT on drive C with the file NEW.BAT on drive D, type the following command.

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 the following command:

fc c:\*.bat d:\*.bat


©sideway

ID: 110700183 Last Updated: 7/27/2011 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Travel 18

Reference 79

Computer

Hardware 254

Software

Application 213

Digitization 37

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 431

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019