Writing a batch file to detect ping anomalies

前端 未结 2 776
借酒劲吻你
借酒劲吻你 2021-01-29 08:59

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

2条回答
  •  甜味超标
    2021-01-29 09:18

    :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
    

提交回复
热议问题