Search notes:

fc.exe

DOS 5 File Compare Utility

Command line options

/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L / /U Compares files as ASCII Unicode text, respectively
/LBn Sets the maximum consecutive mismatches to the specified number of lines.
/N Displays the line numbers on an ASCII comparison.
/OFF[LINE] Do not skip files with offline attribute set.
/T Does not expand tabs to spaces.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match after a mismatch.
Apparently, there is no option to recursively compare files.

Suppress FC: no differences encountered

fc.exe does not operate silently, that is, unlike the Unix shell command diff, it explicitly prints FC: no differences encountered even if the two compared files are equal.
However, fc.exe sets the exit value to 0 if the files are equal ant to 1 if they differ. Because the exit value can be queried through the variable %errorlevel%, this allows to write a batch file which compares two files and remains silent if they're equal (by redirecting the output of fc to nul)
echo off
set file1=%1
set file2=%2

if "%file2%" == "" (echo diff.bat file-1 file-2 && exit /b)

if not exist "%file1%" (echo %file1% does not exist && exit /b)
if not exist "%file2%" (echo %file2% does not exist && exit /b)

fc.exe "%file1% "%file2%" > nul
if %errorlevel% neq 0 ( echo %file1% differs from %file2% )

See also

comp.exe
Some Office versions come with filecompare.exe which also allows to compare two text files.

Index