N
NayJo
When trying to use the for command to compare 2 files inline I only need to
know that the files match or that they don't. Since 'fc' does not set
errorlevel I compare the output of fc to see if I get the message they
matched. If the files don't match I get many lines of data that I don't
necessarily need.
I tried putting a goto in the unmatch condition but this is making the
cmd.exe complain about mis-matched parentheses. Below is the code I am
trying to use. How can I modify this to succeed on match and fail on
mismatch without comparing every difference in the file?
for /F "skip=1 delims=* usebackq" %%L in (`fc /b reference_queries.txt
example_queries.txt`) do (
if "%%L"=="FC: no differences encountered" (
echo Settings are properly configured.
) ELSE (
REM jumpout as it is enough for me to know the files don't match without
processing every difference.
echo Line is %%L
goto jumpout )
)
:jumpout
This yields ") not expected" error but if I remove the goto, the batch runs
just fine.
know that the files match or that they don't. Since 'fc' does not set
errorlevel I compare the output of fc to see if I get the message they
matched. If the files don't match I get many lines of data that I don't
necessarily need.
I tried putting a goto in the unmatch condition but this is making the
cmd.exe complain about mis-matched parentheses. Below is the code I am
trying to use. How can I modify this to succeed on match and fail on
mismatch without comparing every difference in the file?
for /F "skip=1 delims=* usebackq" %%L in (`fc /b reference_queries.txt
example_queries.txt`) do (
if "%%L"=="FC: no differences encountered" (
echo Settings are properly configured.
) ELSE (
REM jumpout as it is enough for me to know the files don't match without
processing every difference.
echo Line is %%L
goto jumpout )
)
:jumpout
This yields ") not expected" error but if I remove the goto, the batch runs
just fine.