I have 32 IPs in a file tracerouteiplistA.txt
In for/while loop of a batch file named tracerouteScriptA.bat,
i want to trace route all of them and store the result in traceA.txt
and if 10. is visible hen i want to write 0 in traceresponseA.txt. if 172. is visible then 1 or else if in case of request time out or fail case i want to write 2.
My current code goes as follows --
@echo off
cd C:\Users\Administrator\Desktop
FOR /F "usebackq delims=*" %%a in (tracerouteiplistA.txt) do (
tracert -h 3 "%%a" > traceA.txt
findstr /m "10." traceA.txt
if %errorlevel%==0 (echo "0" > traceresponseA.txt)
findstr /m "172." traceA.txt
if %errorlevel%==0 (echo "1" > traceresponseA.txt) else (echo "2" > traceresponseA.txt)
)