PDA

View Full Version : Display IP Address from http://checkip.dyndns.org in batch script



Chilling_Silence
31-08-2009, 02:49 PM
Hey all,

So I've got two internet connections on this LAN at work. I want a quick & easy way to switch between them so I've written:

@ECHO OFF
echo Changing to Orcon (Main) connection - 172.31.3.1
route change 0.0.0.0 mask 0.0.0.0 172.31.3.1 metric 25
netsh interface ip set dns name="Local Area Connection" source=static addr=172.31.3.2
netsh interface ip add dns name="Local Area Connection" addr=208.67.222.222
pause

However, what I also want is a quick & easy way for it to display my public-IP from http://checkip.dyndns.org in the command window / batch script, so that I can be assured the change has gone through.

Is there an easy way to do this, short of opening the browser window?

Cheers


Chill.

Chilling_Silence
02-09-2009, 08:02 AM
Bump... Anybody have any ideas? :D

Even if I went about it another way, getting the public-facing IP Address ...?

Thanks


Chill.

Erayd
02-09-2009, 08:42 AM
You can't do this from a standard windows shell, you'll need to call another app - easiest method would be to use a windows binary for curl or wget that you can integrate into your script.