windows下dos窗口实现持续ping显示时间保存至日志
生活随笔
收集整理的這篇文章主要介紹了
windows下dos窗口实现持续ping显示时间保存至日志
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
效果圖
右擊新建 ping.bat 文件(ping為文件名稱,隨便起),內容如下:
cscript?ping.vbs??127.0.0.1?-t?>log.txt127.0.0.1 修改為你自己的ip地址,log 為記錄日志的文件名
右擊新建 ping.vbs 文件(ping為文件名稱,隨便起,但是需要與上方 csript xxx.vbs 對應),內容如下:
Dim?args,?flag,?unsuccOut args="" otherout="" flag=0If?WScript.Arguments.count?=?0?Then WScript.Echo?"Usage:?cscript?tping.vbs?[-t]?[-a]?[-n?count]?[-l?size]?[-f]?[-i?TTL]?[-v?TOS]" WScript.Echo?"?????????????????????????[-s?count]?[[-j?host-list]?|?[-k?host-list]]" WScript.Echo?"?????????????????????????[-r?count]?[-w?timeout]?destination-list" wscript.quit End?ifFor?i=0?to?WScript.Arguments.count?-?1 args=args?&?"?"?&?WScript.Arguments(i) NextSet?shell?=?WScript.CreateObject("WScript.Shell") Set?re=New?RegExp re.Pattern="^Reply|^Request|^來自|^請求"Set?myping=shell.Exec("ping"?&?args)while?Not?myping.StdOut.AtEndOfStreamstrLine=myping.StdOut.ReadLine() 'WScript.Echo??"原數據"?&?chr(9)?&?strLiner=re.Test(strLine)If?r?Then WScript.Echo?date?&?"?"&?time?&?chr(9)?&?strLine flag=1Else unsuccOut=unsuccOut?&?strLineEnd?if Wendif?flag?=?0?then WScript.Echo?unsuccOut end?if文件下載
下載地址:https://files.cnblogs.com/files/niceyoo/ping.rar
總結
以上是生活随笔為你收集整理的windows下dos窗口实现持续ping显示时间保存至日志的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 金字塔原理
- 下一篇: java信息管理系统总结_java实现科