IF spaces are going to cause problems then I'll make sure we do not have files with spaces.
The script is reading the file test1.txt which is the only file which has ERROR = 1 within it, and then sending test-BAD. Which should not be the case as it should be ignoring this file, and moving onto the next one file.
any suggestions
Main Topics
Browse All Topics





by: _nn_Posted on 2003-11-05 at 06:55:49ID: 9687115
Hi again :)
I'd propose :
@echo off
set COUNT=0
for /F "skip=1 tokens=1-3" %%a in ('find /C "ERROR = 1" C:\test_search\*.txt') do call :increment %%b %%c
:: uncomment if needed
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.
goto end
:increment
for /f %%k in ('dir /b C:\test_search\*1.*') do if /i "%%k"=="%1" goto end
set /A COUNT=%COUNT%+%2
:end
I'm suddenly realizing that we could run into problems if the filenames happen to have spaces in them. Can this happen ?