本帖最后由 ygqiang 于 2015-12-22 21:46 编辑
已经解决。- '判断网络是否畅通,当大于500毫秒即判断为超时。
- Set ws = WScript.CreateObject("WScript.Shell")
-
- Fir=""
- Sec=""
-
- TheIP1 = "192.168.11.118"
- aaserv = "aa服务器"
-
-
- TheIP2 = "10.10.128.13"
- bbserv = "bb服务器"
-
-
-
- PingSet = " -n 1 -l 1 -w 500 "
- TheState = ws.run("ping.exe " & TheIP1 & PingSet ,0, True)
- If TheState = 0 Then
- Fir= aaserv & TheIP1 & "网络通畅"
- Else
- Fir= aaserv & TheIP1 & "网络不通畅"
- End If
-
-
- PingSet = " -n 1 -l 1 -w 500 "
- TheState = ws.run("ping.exe " & TheIP2 & PingSet ,0, True)
- If TheState = 0 Then
- Sec= bbserv & TheIP2 & "网络通畅"
- Else
- Sec= bbserv & TheIP2 & "网络不通畅"
- End If
-
-
- 'MsgBox Fir & vblf & Sec
-
- msg = CreateObject("wscript.shell").popup (Fir & vblf & Sec,"8")
- if msg = vbCancel then
- wscript.quit
- end if
复制代码
|