View Single Post
  #3 (permalink)  
Old October 18th, 2006, 12:10 PM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Set objShell = CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec(ping -n 3 -w 1000 " & sAddress)

This will ping the address specified in the sAddress variable.
If you want the window to stay open while the operation is running, then do this:

Set objExecObject = objShell.Exec("%comspec% /c ping -n 3 -w 1000 " & sAddress)

Or

Set objExecObject = objShell.Exec("%comspec% /k ping -n 3 -w 1000 " & sAddress)

By using %comspec%, this script will run in any Windows environment, as opposed to using "cmd.exe" or some other variant.

Does this help?



mmcdonal
Reply With Quote