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 got
I use the below example to build reports based on file differences:
set %Batch_Work_Space_Dir%=folder for your batch file and temp resource files
set file_1=name of file
set file_2=name of file
fc %file_1% %file_1%t > %Batch_Work_Space_Dir%\Are_They_Different.txt
powershell -command "(Get-Content %Batch_Work_Space_Dir%\Are_They_Different.txt) | select -skip 1 | Set-Content %Batch_Work_Space_Dir%\Are_They_Different.txt"
set /p Diff_Found=<%Batch_Work_Space_Dir%\Are_They_Different.txt
if %Diff_Found:~0,17%" == "FC: no difference" (
execute commands
)