Just to add to the great code from Frank you may want to change the 'ping ' to 'ping -n 1 '. This will provide 1 ping, 1 ping only Mr verselli (sorry Red October moment). Seriously though, DEFAULT # of pings = 4, this will send 1x ping ....
Good Hunting!
AJ Ahrens
webmaster@kritter.net