Batch File to shift over.

  • Thread starter Thread starter Nimit Mehta
  • Start date Start date
N

Nimit Mehta

I have 2 internet connections. Cables of both go in a
switch and from there directly into my server serving 60
nodes. Gateway of one ISP is 172.16.0.1. I want to make a
batch file that would ping 172.16.0.1 every 30 seconds and
look for "Reply". If it gets a reply, it wouldnt do
anything, if gets timed out, it should call another batch
file that has NETSH script to change the IP. possible?
 
Nimit Mehta said:
I have 2 internet connections. Cables of both go in a
switch and from there directly into my server serving 60
nodes. Gateway of one ISP is 172.16.0.1. I want to make a
batch file that would ping 172.16.0.1 every 30 seconds and
look for "Reply". If it gets a reply, it wouldnt do
anything, if gets timed out, it should call another batch
file that has NETSH script to change the IP. possible?

How about this:

@echo off
:again
ping 172.16.0.1 | find /i "bytes=" || call c:\tools\OtherBatchFile.bat
ping localhost -n 30
goto again

Don't look for "reply" with ping.exe - it's ambiguous. Look for "bytes="
instead.
 
Back
Top