A pattern to equal a wildcard
Posted on 2003-11-06
I have the following script, but I need to be able to search for ERROR = 1 OR MORE, as the amont of errors in the file could be more than 1. All suggestions welcome:
:: global parameters, please adapt as needed
set PATTERN=ERROR = 1
for /f "delims=" %%a in ('dir /b *.* ^|findstr /v "1."') do call :increment "%%a"
echo Found %COUNT% occurences. Sending message...
if %COUNT% GEQ 1 (
net send pc-000024 test-BAD
) else (
net send pc-000024 test-GOOD
echo Message sent.
:: filenames without path won't have a ':'
for /f "tokens=1-2 delims=:" %%a in ('find /C "%PATTERN%" %1') do set /A COUNT=%COUNT%+%%b