The FC command (File Compare) in Windows Command Prompt is used to compare two files or sets of files and display the differences between them. This command is particularly useful for users who need to compare the contents of text files to identify variations, such as developers comparing versions of source code, or administrators verifying configuration files.


The general syntax for the FC command is:

FC [options] file1 file2
  • file1 and file2 are the names of the files you want to compare.

Various syntax options include:

FC /B file1 file2
FC /C file1 file2
FC /A file1 file2
FC /L file1 file2
FC /L /N file1 file2
FC /L /N /W file1 file2

Each set of switches provide different modes of comparison or output formatting.


  • /A – Displays only the first and last lines for each set of differences.
  • /B – Performs a binary comparison.
  • /C – Ignores the case of letters.
  • /L – Compares files as ASCII text.
  • /N – Display line numbers on an ASCII comparison.
  • /U – Compares files as Unicode text files.
  • /W – Compresses white space (tabs and spaces) for comparison.
  • /nnnn – Specifies the number of consecutive lines that must match after a mismatch.


Example 1: Basic Text Comparison

FC file1.txt file2.txt

This command compares file1.txt and file2.txt as ASCII text and displays differences.

Example 2: Binary Comparison

FC /B image1.jpg image2.jpg

Compares two images image1.jpg and image2.jpg in binary mode to check for any differences at a binary level.

Example 3: Ignoring Case in Text Comparison

FC /C /L file1.txt file2.txt

Compares file1.txt and file2.txt as ASCII text, ignoring differences in case.

Common Issues

  • File Accessibility: Ensure both files are accessible and not locked by another process.
  • Large File Comparison: FC can be slow or fail with very large files. Using more specialized tools might be more efficient.
  • Binary Misinterpretation: Using text comparison flags on binary files or vice versa might yield confusing results.


Combine FC with other CMD commands for automated tasks, such as:

FC file1.txt file2.txt > diff.txt
IF %ERRORLEVEL% == 1 ECHO Differences Found.

This example compares two files and writes the differences to diff.txt. Then, checks if differences were found (error level 1) and displays a message.

  • COMP – Another command line tool used for file comparison, but with slightly different options.
  • DIFF – Often used in Unix/Linux environments, available on Windows through third-party tools or subsystems for Linux.

For more commands and deeper insights, refer to the Windows command line documentation.