我在 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