标签:网络 goto date pad enable ping %s logfile ipad
@echo on setlocal ENABLEDELAYEDEXPANSION set ipadd=10.12.100.212 set stepTime=5 set logFile=d:\pingLog.txt set fval=30 set size=32 :goon ping -n %stepTime% 127.1>nul for /f "tokens=5 delims= " %%a in (‘ping -l %size% %ipadd% -n 1^|findstr /c:"时间"‘) do ( set t=%%a goto :test ) goto :error1 :test echo 检测结果: %t% set t=!t:~3! set t=!t:ms=! if !t! GEQ %fval% (goto :error2) goto :goon :error1 echo 记录访问超时 %t% echo %date% %time% 访问超时 %ipadd% >>%logFile% goto :goon :error2 echo 记录延时结果 %t% 大于等于设定阈值 %fval% echo %date% %time% 访问延时 %ipadd% !t! ms>>%logFile% goto :goon
标签:网络 goto date pad enable ping %s logfile ipad
原文地址:https://www.cnblogs.com/turnip/p/11429803.html