How can I compare two files in a batch file, and perform an action based on whether or not they match? I’ve tried something like:
if file1.txt NEQ file2.txt goto label
but it compares the actual string ‘file1.txt’ rather than the file. I’ve read about the COMP command, but it doesn’t seem to work if I put it in an if statement. Does anybody know how to do this? Sorry, but I rarely use batch files and have little experience in them.
Thanks in advance.
I believe you can use the ‘FC’ command and then check the errorlevel. Here’s some code:
(Pulled from http://www.computing.net/answers/dos/batch-file-command/15753.html)