help needed to write a batch file that test ping help needed to write a batch file that test ping
Posted 28 March 2009 - 10:27 PM
i need to write out a batch that can help me continously ping a ip address.
eg. ( ping 126.96.36.199 -t)
if during the pinging, there is request time out or destination host unreachable, the batch file will automatically net send to another computer ( which is in the same domain as mine ) to inform him that ping failed.
is it possible?
Posted 14 April 2009 - 11:19 AM
@chunhin : I'm not sure if it's possible to do what you'd like with a batch file, but some simple scripting in VBScript could do the trick. Take a look at this topic.
Posted 14 April 2009 - 01:03 PM
Can you post the output of a "single" working "ping" and those with the "ping errors" that you want the alarm (redirection or whatever) to be triggered with?
Another VBS script that might be useful:
Posted 14 April 2009 - 01:15 PM
This post has been edited by AO3: 14 April 2009 - 01:17 PM
Posted 17 December 2009 - 11:17 AM
Here is a possible script.
# Script ping15sec.txt var str output, lost while (true) do # Ping. Collect output into variable $output. system "ping 188.8.131.52" > $output # Get the lost packect count. It is after "Lost =" in $output. stex -c -r "^Lost;=;^[" $output > $lost stex -c -r "[^,^" $lost > null # $lost must be "0". If not, something went wrong. if ($lost <> "0") do # Do something to report error here. For now, we will just shout. echo "LOST " $lost " PACKETS AT TIME " gettime() done endif # Sleep for 60 seconds sleep 60 done
Save the script in file C:/Scripts/ping15sec.txt, start biterscripting ( http://www.biterscripting.com ), enter the following command.
- ← Digital Certificate
- Server - Side Help (IIS, Apache, etc.)
- Website: intranet working, internet not working →