Re: Process one line of output only?...
- From: "Jens Hastrup" <jfh@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 10 Jan 2007 22:00:36 +0100
"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
.
- References:
- Process one line of output only?...
- From: NayJo
- Process one line of output only?...
- Prev by Date: Re: Process one line of output only?...
- Next by Date: Re: Process one line of output only?...
- Previous by thread: Re: Process one line of output only?...
- Next by thread: Re: Process one line of output only?...
- Index(es):
Relevant Pages
|