Although quite proficient at Unix shell scripting, I know very little about
the syntax of a DOS *.bat file, and would appreciate your help please.
The goal is to monitor a network connection, and if it fails, to dial a
named dialup Network Connection.
The idea that occurs to me is to check (using the Task scheduler) once per
minute whether Internet network continuity is intact, e.g.:
ping www.google.com
How do I tell in a batch file if that command was successful, or if it
failed? It would be simple in Unix, as all commands have a numerical exit
status that can be checked; a successful command has an exit status of 0
(zero):
ping -c1 www.google.com > /dev/null 2>&1; echo $?
0
ping -c1 wwww.google.com > /dev/null 2>&1; echo $?
1
How is such a thing accomplished in a batch file please? Does the ping
command issue an exit code that can be checked, or is there a different
method necessary?


|