问题描述
我在Excel中制作了一个工具来捕获来自多个IP的ping,但是当我将-n参数设置为更大的值时,它存在问题。第一个IP运作良好,但第二个IP延迟了,我必须手动将它们破坏。
-n 300的采样结果:
- IP1:已发送= 300
- IP2:已发送= 102
- IP3:已发送= 77
- IP4:已发送= 75
- IP5:已发送= 75
有什么建议吗?
非常感谢
Sub runPing(可选参数作为字符串)
Dim sh As Object
Dim shEx1 As Object
Dim pingComand1 As String
Dim buffor1 As String
Dim shEx2 As Object
Dim pingComand2 As String
Dim buffor2 As String
Dim shEx3 As Object
Dim pingComand3 As String
Dim buffor3 As String
Dim shEx4 As Object
Dim pingComand4 As String
Dim buffor4 As String
Dim shEx5 As Object
Dim pingComand5 As String
Dim buffor5 As String
Set sh = CreateObject("WScript.Shell")
pingComand1 = ActiveSheet.Range("B3")
pingComand2 = ActiveSheet.Range("B4")
pingComand3 = ActiveSheet.Range("B5")
pingComand4 = ActiveSheet.Range("B6")
pingComand5 = ActiveSheet.Range("B7")
If Parameters = "" Then
pingComand1 = pingComand1 & " " & ActiveSheet.Range("C3")
pingComand2 = pingComand2 & " " & ActiveSheet.Range("C4")
pingComand3 = pingComand3 & " " & ActiveSheet.Range("C5")
pingComand4 = pingComand4 & " " & ActiveSheet.Range("C6")
pingComand5 = pingComand5 & " " & ActiveSheet.Range("C7")
Else
pingComand1 = pingComand1 & " " & Parameters
pingComand2 = pingComand2 & " " & Parameters
pingComand3 = pingComand3 & " " & Parameters
pingComand4 = pingComand4 & " " & Parameters
pingComand5 = pingComand5 & " " & Parameters
End If
pingComand1 = "C:\Windows\System32\PING.exe " & pingComand1
pingComand2 = "C:\Windows\System32\PING.exe " & pingComand2
pingComand3 = "C:\Windows\System32\PING.exe " & pingComand3
pingComand4 = "C:\Windows\System32\PING.exe " & pingComand4
pingComand5 = "C:\Windows\System32\PING.exe " & pingComand5
Set shEx1 = sh.Exec(pingComand1)
Set shEx2 = sh.Exec(pingComand2)
Set shEx3 = sh.Exec(pingComand3)
Set shEx4 = sh.Exec(pingComand4)
Set shEx5 = sh.Exec(pingComand5)
buffor1 = shEx1.StdOut.ReadAll
buffor2 = shEx2.StdOut.ReadAll
buffor3 = shEx3.StdOut.ReadAll
buffor4 = shEx4.StdOut.ReadAll
buffor5 = shEx5.StdOut.ReadAll
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)