Reputation: 7
What I'm trying to achieve is to call windows command line COMP from my batch file. And then get it's resulting message whether it has differences or not. Is it possible? I have a separate exe to call in comparing files that outputs its differences. But before I call that exe, first I want to know if there are really differences between the files. 'Cause I just want to generate report for those files that has differences. Unfortunately, that separate exe that I use for comparing does not have the capability to know if there are differences via command prompt. It just always generate the result of the files whether it has differences or not.
Upvotes: 0
Views: 121
Reputation: 354356
Don't use comp
, but fc
. comp
always asks whether you want to compare more files, which would be rather obnoxious in a batch file.
Then you can use
fc file1 file2 >nul && (
echo Identical
) || (
echo Different
)
Upvotes: 1