Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
March 15, 2006
I first described the FC.EXE command at tip 0305 Windows NT 4.0 has two built in File comparison commands.
Using the built-in FC.EXE, I have scripted AnyDiff.bat to determine if there is any difference between two specified files.
The syntax for using AnyDiff.bat is:
Call AnyDiff File1 File2 YorN
Where:
File1 is the path to the first file.File2 is the path to the second file.YorN is a call directed environment variable that will contain a Y if there any difference between the two files, or an N if there is no difference.
AnyDiff.bat contains:
@echo offif {%3}=={} @echo Syntax: AnyDiff File1 File2 YorN&goto :EOFif not exist %1 @echo AnyDiff %1 %2 %3 - %1 NOT found.&goto :EOFif not exist %2 @echo AnyDiff %1 %2 %3 - %2 NOT found.&goto :EOFfc /b %1 %2|find /i "no differences">nulif errorlevel 1 (set %3=Y) ELSE (set %3=N)
You May Also Like