批处理(BAT) Ping监控, 结果记录入日志文件

::执行效果

 1 @echo off
 2 
 3 ::等待用户输入需要监控IP
 4 set /p ip=Input the IP required to monitor:
 5 echo executing......
 6 :start
 7 echo|set /p ="!"
 8 
 9 ::将时间插入到日志文件
10 echo %date% %time% >>%ip%_log.txt
11 ::findstr "Reply Request", 服务器端
12 ::find "来自", PC机端
13 
14 ::测试结果插入到日志文件
15 ping -n 1 %ip% | find "来自" >>%ip%_log.txt
16 
17 ::调节结果输出的频率
18 ping 127.0.0.1 -n 4 >nul
19 goto start
20 pause

::日志文件内容

原文地址:https://www.cnblogs.com/William-Guozi/p/BAT_PING.html