eric godthelp
asked on
Ping record but only pings higher then <1ms
I got this script now running
@echo off
set /p host=host Address:
set logfile=Log_%host%.log
echo Target Host = %host% >%logfile%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo %date% %time:~0,2%:%time:~3,2%:%t ime:~6,2% %%A>>%logfile%
echo %date% %time:~0,2%:%time:~3,2%:%t ime:~6,2% %%A
timeout 1 >NUL
GOTO Ping)
But i want it so that all the Pings that are <1ms are not recorded.
Is this possible?
@echo off
set /p host=host Address:
set logfile=Log_%host%.log
echo Target Host = %host% >%logfile%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (echo %%A>>%logfile% && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo %date% %time:~0,2%:%time:~3,2%:%t
echo %date% %time:~0,2%:%time:~3,2%:%t
timeout 1 >NUL
GOTO Ping)
But i want it so that all the Pings that are <1ms are not recorded.
Is this possible?
ASKER
If i use that script if i have a timeout it wont record it either.
If i change the time<1ms too time<0ms. it also records nothing
If i change the time<1ms too time<0ms. it also records nothing
Okay, try this:
»bp
@echo off
setlocal
set /p host=host Address:
set logfile=Log_%host%.log
echo Target Host = %host% >%logfile%
for /f "tokens=*" %%A in ('ping %host% -n 1 ') do (
echo %%A>>%logfile%
goto Ping
)
:Ping
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1 ') do (
echo.%%A|find /i "time<1ms" >NUL && (
timeout 1 >NUL
goto Ping
)
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile%
echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A
timeout 1 >NUL
goto Ping
)
»bp
ASKER
All i get in the Log is:
Target Host = 192.168.255.135
Pinging 192.168.255.135 with 32 bytes of data:
I set the Time<100ms to test it
Target Host = 192.168.255.135
Pinging 192.168.255.135 with 32 bytes of data:
I set the Time<100ms to test it
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks you very much.
This works perfectly
This works perfectly
Open in new window
»bp