编写一个批处理文件来检测异常平 [英] Writing a batch file to detect ping anomalies

查看:100
本文介绍了编写一个批处理文件来检测异常平的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个批处理文件,它会检测到平异常。我希望它来ping到IP无限(-t),直到我关闭它哪里会写下来,每当MS> 100毫秒,时间戳以及。我想某处的子字符串变量的行,但我不知道如何来包装我的头周围。


解决方案

 :环路
时间/ T>> TextFile.txt的
平-N 1 127.0.0.1 | FINDSTR / C:最小>> TextFile.txt的
超时/吨5
转到循环

或者,也许这适合你的需要。

 平/ T> TextFile.txt的

 :循环
    WMIC /append:\"textfile.txt路径的Win32_PingStatus其中地址=127.0.0.1和RESPONSETIME→100得到RESPONSETIME,timestam precord
转到循环

I'm trying to create a batch file where it would detect ping anomalies. I want it to ping to an IP infinitely (-t) until I close it where it would write down whenever ms > 100 ms and the time stamp as well. I'm thinking somewhere along the lines of sub string variables but I don't know how to wrap my head around it.

解决方案

:Loop
time /t >> textfile.txt
ping -n 1 127.0.0.1 | findstr /c:"Minimum" >> textfile.txt
timeout /t 5
Goto Loop

Or perhaps this suits your needs

ping /t > textfile.txt

or

:loop
    wmic /append:"textfile.txt" path win32_pingstatus where "address='127.0.0.1' and responsetime > 100" get responsetime,timestamprecord
goto loop

这篇关于编写一个批处理文件来检测异常平的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆