Is there an easy way to tell if two files have byte-for-byte identical
contents without displaying anything to the user? I have a batch file that
wants to do different things depending on whether or not two files are
identical. TIA.
Type FC /? for the usage, or use this entry from my "book" on
DOS commands.
FC Command
=======================
=======================
Compares two files or sets of files and displays the differences between
them.
FC [/A] [/C] [/L] [/LBn] [/N] [/T] [/W] [/nnnn] [drive1:][path1]filename1
[drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified number of
lines.
/N Displays the line numbers on an ASCII comparison.
/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.
--
Sincerely, | (©) (©)
| ------ooo--(_)--ooo------
Andrew H. Carter | /// \\\
d(-_-)b |
@echo off
fc /b file.txt file2.txt >nul&& goto :identical
:different
echo the files are different
goto :EOF
:identical
echo the files are the same
goto :EOF
> Thanks a million. What the heck does "&&" do?
It executes the following statements on errorlevel 0
similarly || executes the following statements on errorlevel 1