Re: Process one line of output only?...

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"NayJo" <CrawNOSPAMforMEford@xxxxxxxxxxxxxx> skrev i en meddelelse
news:u32E3qNNHHA.4912@xxxxxxxxxxxxxxxxxxxxxxx
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.

Hi,

On my computer fc does in fact return errorlevel .. so this works for me

fc /b reference_queries.txt example_queries.txt >nul 2>&1 && echo No
differences encountered && goto :EOF

Jens


.



Relevant Pages

  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... REM jumpout as it is enough for me to know the files don't match ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... REM jumpout as it is enough for me to know the files don't match ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... echo Settings are properly configured. ... REM jumpout as it is enough for me to know the files don't match ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Process one line of output only?...
    ... errorlevel I compare the output of fc to see if I get the message they ... I tried putting a goto in the unmatch condition but this is making the ... REM jumpout as it is enough for me to know the files don't match ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: robocopy validation
    ... Robocopy did not copy any files. ... if errorlevel 8 echo **FAILED COPIES** & goto end ...
    (microsoft.public.win2000.general)