@echo off
rem 这里的192.168.0.5就是你需要ping的IP地址
set ping_url=192.168.0.5
:top
set h=%time:~,2%
set "h=%h: =%"
rem 这里的D:\5#Device 就是我这边提前新建的存放文件的路径
set filePath=D:\5#Device\%date:~,4%-%date:~5,2%-%date:~8,2%-%h%.txt
echo %date% %time%
echo %date% %time%>>%filePath%
ping %ping_url% | findStr "TTL" >> %filePath%
goto top