Batch File to shift over.

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?
 
P

Pegasus \(MVP\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top