Lapas

trešdiena, 2016. gada 26. oktobris

Ping to file with timestamp

Create batch file:
@echo: off 
set host=192.168.1.1
set logfile=Ping.txt
ping -l 1000 -t %host%|cmd /q /v /c "(pause&pause)>nul & for /l %%a in () do (set /p "data=" && echo(!time! !data!)&ping -n 2 %host%>nul" >> %logfile%


To test from command line use %a instead of %%a

Output:
9:21:50.24 Pinging 192.168.1.1 with 1000 bytes of data:
 9:21:51.29 Reply from 192.168.1.1: bytes=1000 time=43ms TTL=61


Source: stackoverflow.com

Nav komentāru:

Ierakstīt komentāru