J
Joel
I have a VBA utility (lifted from VBScript, and run in VBA in Access) that
looks like:
Public Function PingPC(strComputer As String)
Dim strPingResults As String
Dim objShell, objScriptExec
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( _
"ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
If InStr(strPingResults, "destination net unreachable") Then
Debug.Print strComputer & "did not respond to ping."
Else
Debug.Print strComputer & " responded to ping."
End If
Else
Debug.Print strComputer & " did not respond to ping."
End If
End Function
It works great, except...
....that annoying little command prompt window shows up on the screen when
you ping.
Now, this fuction is called from another routine, that loops through a range
of IP addresses. That's right ... you guessed it ... for each ping, that
little window pops up.
And, according to the web site I lifted this from
(http://msdn.microsoft.com/library/d...ry/en-us/wmisdk/wmi/wmi_tasks__networking.asp),
using WMI doesn't work on Win2K or Win95/98 desktops. You have to use the
old-fashioned command line ping method.
Is there any way to ping the PC via the command line, but suppress the
command line window from appearing on the screen?
Thanks!
looks like:
Public Function PingPC(strComputer As String)
Dim strPingResults As String
Dim objShell, objScriptExec
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( _
"ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "reply from") Then
If InStr(strPingResults, "destination net unreachable") Then
Debug.Print strComputer & "did not respond to ping."
Else
Debug.Print strComputer & " responded to ping."
End If
Else
Debug.Print strComputer & " did not respond to ping."
End If
End Function
It works great, except...
....that annoying little command prompt window shows up on the screen when
you ping.
Now, this fuction is called from another routine, that loops through a range
of IP addresses. That's right ... you guessed it ... for each ping, that
little window pops up.
And, according to the web site I lifted this from
(http://msdn.microsoft.com/library/d...ry/en-us/wmisdk/wmi/wmi_tasks__networking.asp),
using WMI doesn't work on Win2K or Win95/98 desktops. You have to use the
old-fashioned command line ping method.
Is there any way to ping the PC via the command line, but suppress the
command line window from appearing on the screen?
Thanks!