使用场景
监控网络是否正常
使用说明
1、将日志保存在F盘中date.txt文件中
2、ping的网址为:www.baidu.com
3、执行间隔为2秒
4、ping %ping_url% -n 1 | findStr “TTL” >> %filePath%
将日志中包含"TTL"的日志保存到文件中,其他不保存
@echo off
set filePath=F:\date.txt
set ping_url=www.baidu.com
set sleep_times=2
:top
echo starting test network...%time%
echo %date% %time%>>%filePath%
ping %ping_url% >> %filePath%
ping -n %sleep_times% 127.1 >nul
goto top