Command: fc

  FC compares two files or sets of files, in text or binary mode,
  and displays the differences between them.

Syntax:

  FC [switches] [drive1:][path1]filename1 [drive2][path2]filename2
     [switches]

Options:

  /A    Display only first and last lines for each set of differences.
  /B    Perform a binary comparison.
  /C    Disregard the case of letters.
  /L    Compare files as ASCII text.
  /LBn  Set the maximum number of consecutive different ASCII lines
        to n.
  /Mn   Set the maximum differences in binary comparison to n bytes
        (default = 20, 0 = unlimited, /M = /M0).
  /N    Display the line numbers on a text comparison.
  /Q    Don't show the list of differences.
  /R    Show a brief final report (always active when using /S).
  /S    Extend the scan to the files in subdirectories.
  /T    Do not expand tabs to spaces.
  /U    Show the filenames of the files without a correspondent.
  /W    Pack white space (tabs and spaces) for text comparison.
  /X    Do not show context lines in text comparison.
  /nnn  Set the minimum number of consecutive matching lines to nnn.
        for comparison resynchronization.
  /?    Shows the help.

Comments:

  FC is LFN aware and use them automatically if the operating system
  supports the long file names.
  FC defaults to binary mode for files .EXE, .COM, .SYS, .OBJ, .BIN,
  .DLL and .LIB.
  In binary mode FC shows the offset in the file of the differing bytes,
  their value in hexadecimal and, if they are ASCII printable chars,
  their ASCII char.
  By default the binary compare stops after 20 differences but that
  value can be modified through the /M switch. /M0 means "unlimited
  differences". /M is interpreted as /M0.
  A design limitation of this program is that, in the text mode file
  comparison, only the first 32765 lines are compared; the remaining
  lines are ignored. The line length is virtually unlimited.

  FC supports wildcards in the file specifications. Some words on this:
    -  Specifying a directory is the same as specifying all the files in
       that directory (i.e. "*.*"), see Example 1 below.
    -  If no filename2 is entered then "." (the current directory) is
       assumed, see Example 2 below.
    -  If filename1 has wildcards but filename2 hasn't, then all the
       files matching filename1 are compared with the same file
       filename2, see Example 3 below.
    -  If filename1 has wildcards and filename2 is a path followed by
       "*.*" then all the files matching filename1 are compared with
       the files with the same name but in the path specified by
       filename2 (if that file exists, of course), see Example 4 below.
    -  If filename1 has wildcards and filename2 too then all the files
       in the path of filename1 and matching filename1 are compared with
       the relevant file matching filename2 in the path specified by
       filename2 (if that file exists, of course), see Example 5 below.

  It's more easily done than said.
  If what you really want is to compare each file in a directory with
  all the files in another you can always use the form:
  Example 6: FC *.* MYDIR\????????.???

  The /S option iterates the same pattern of search in the sub-
  directories with the same name in both path.
    Example 7: "FC /S C:*.TXT D:*.BAK"
  Assuming for example the existence of the subdirectories C:BOOK and
  D:BOOK, this command compares all the *.TXT files with their backup
  copies *.BAK in the current directories and also all the BOOK\*.TXT
  files with their backup copies BOOK\*.BAK.

  FC supports NLS (national language support).
  FC has the following ERRORLEVEL /EXITCODES:
    0  All the files match
    1  At least a pair of files differs
    2  Invalid parameter on the command line
    3  File not found
    4  Error opening file(s)

Examples:

  (Explanations see above)
  Example 1:
    "FC C:\ A:" is the same as "FC C:\*.* A:*.*"
  Example 2:
    "FC C:\FOO.TXT" is the same as "FC C:\FOO.TXT .\*.*"
  Example 3:
    "FC FOO.BK? FOO.TXT"
  All the files FOO.BK? are compared with FOO.TXT
  Example 4:
    "FC *.* A:*.*" or, in short, "FC . A:"
  All the files in the current directory are compared with
   their copy on A:
  Example 5:
    "FC *.TXT OLDS\*.BAK"
    All the files in the current directory are compared with their
    backup copy renamed .BAK in the subdirectory OLDS.
  Example 6: (see above)
    FC *.* MYDIR\????????.???
  Example 7:
    "FC /S C:*.TXT D:*.BAK"
  Example 8:
  FC /L /M0 C:\ foo.txt D:\foo.txt

See also:

  comp
  diskcomp
  doslfn
  errorlevel / exitcode
  md5sum

  Copyright © 1999 Maurizio Spagni, updated 2022 by W. Spiegl.

  This file is derived from the FreeDOS Spec Command HOWTO.
  See the file H2Cpying for copying conditions.