Finding a string in report-files

July 20, 2009 at 08:27:08
Specs: Windows XP
Hi there,

I need to find an exact sting match within about 600-report files. This is to know which systems are affected.
In addition I need to perform multiple string tests

I tried something like this. But I can't seem to get the syntax 100% right

for /F %%a in (DeviceList.txt) do (

find "Telnet service was enabled" "%_DirRpt%%%a.rpt"
if ERRORLEVEL neq 0 echo %%a>> "%_DirTest%telnet.good"
if ERRORLEVEL 0 echo %%a>> "%_DirTest%telnet.bad"

find "snmp v1 service was enabled" "%_DirRpt%%%a.rpt"
if ERRORLEVEL neq 0 echo %%a>> "%_DirTest%snmp.good"
if ERRORLEVEL 0 echo %%a>> "%_DirTest%snmp.bad"

)


See More: Finding a string in report-files

Report •


#1
July 21, 2009 at 00:30:18
if errorlevel x means x *OR MORE* so the 0 test is meaningless.

Use:

if %errorlevel% equ 0

or:

if "%errorlevel%"=="0"


=====================================
If at first you don't succeed, you're about average.

M2


Report •
Related Solutions


Ask Question