- Dim Counter
- Counter=0
- Do While Abs(Counter) < 50000
- WScript.Sleep 5000
- Counter=Counter+Ping("www.sohu.com")
- Loop
-
- Function Ping(s)
- Dim wmi
- Set wmi=GetObject("winmgmts://./root/cimv2")
- For Each i in wmi.ExecQuery("Select * From Win32_PingStatus Where Address='" & s & "'")
- If i.StatusCode=0 Then
- x=1
- Else
- x=-1
- Msgbox "网络连接被断开!"
- End If
- Next
- Ping=x
- End Function
复制代码
|