I am writing a shell script using the Windows NT(ish) shell scripting language. (My computer has Windows 10.) I want to check if two text files are identical. If the files are identical, I want my script to do one thing. If the files are not identical, I want my script to do something else. The script should not pause to ask for manual entry of more data.
The "Similar Questions" list has questions about Macintosh and bash shell scripts. It also has an answer about running fc or comp from the command line, which provide a verbose output. Unfortunately, fc does not return a result to %errorlevel%, andcomp asks for manual data entry instead of simply exiting.
I have a copy of Tim Hill's book on Windows NT shell scripting. Page 216 has the following line of code, where %D1% and %D2% are directories, but I do not know how to modify it to work on just a single pair of files:
for /f "tokens=*" %%I in ('fc /b %D1%\*.* %D2%\*.* ^| find /v "Comparing" ^| find /v "FC: no*"') do (set /a ERRORS+=1) & (echo %%I)