[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


WAN IP from Command Prompt

Posted on 2007-08-02
Medium Priority
Last Modified: 2013-12-09
OK, so I have comcast high speed at home, and I have set-up RDP. But comcast like to change my ip without telling me. What I want to do is create a batch file to run at start-up that gets my WAN IP and uploads it in a text file to an FTP site. I know there is no-ip.org and stuff but I have enough services as it is. I can't seem to figure out how to get the WAN IP from a command prompt. I can figure out how to upload it to an FTP site (I think) but is it even possible to get WAN IP from CMD?

Thanks in advance
Question by:jeremy092288
  • 3
  • 3
  • 2
  • +3
LVL 31

Accepted Solution

merowinger earned 128 total points
ID: 19616531
what about his?
u have to install a ftp client for examble coreftp (freeware)
dim objShell
set objShell = CreateObject("Wscript.Shell")
objShell.Run("ipconfig /all > C:\ipconfig.txt")
wscript.sleep 3000
objShell.Run (chr(34) &"c:\program files\coreftp\coreftp.exe &chr(34)) -O -u c:\ipconfig.txt  -site mysite  -p /upload/  -s")
more command line infos: coreftp.exe /?

Assisted Solution

garyrafferty earned 124 total points
ID: 19616571
Hi you can download a free program called Watch WAN IP that monitors your router and if your WAN IP address changes to can set the program up to Email you of the change

LVL 18

Assisted Solution

chuckyh earned 124 total points
ID: 19616589
Why not get Logmein Free and just remote into your pc and forget RDP. Safer than opening up your RDP port to the internet too.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 19616724
Ip config /all doesn't even return the WAN IP.... I don't want any more services running on my pc. Anyone know how to get the WAN IP from Command Prompt?
LVL 31

Expert Comment

ID: 19616776
LVL 18

Expert Comment

ID: 19616861
Ignore the first person, your computer has no idea what it's WAN ip is because it's behind a router and all of it's traffic is nated. There are webpages like www.whatismyip.com that will show you in a browser what your external IP is.  it would be tough to integrate that into a command though, maybe refresh the page and save it. and upload the page to your ftp site. OR
One thing you might be able to do, if you can send an email from the machine every hour, you can check the message header for the ip address.

Assisted Solution

Mshine earned 124 total points
ID: 19617058
I had this same problem.. The way I handled it in the past, was like this.. Hope I can be clear.

When you send out an email, there is a bunch of header information attached
to that email, that is not visible in most email clients up front. Here is a little trick
but would require you to leave Outlook or whatever email client you use,
up and running, and configured to auto send through the Rules Wizard.

What I did was set up a RULE in MS Outlook at my house.. When it would receive an email
with a certain "subject line", it would forward the message to my hotmail account. So when
I could not connect RDP to my house and I suspected IP change, I would send an email to
my house with the key "Subject line", which would trigger Outlook to forward the email back to me,
thus attaching the WAN IP address to the email, andforwarding it to me.

Once I do this, I can go to my hotmail inbox, right click on the email in the inbox and select
view source.. I will give you a plain text view of the email.... the IP address you will be looking
for will be pretty close to the top of that page. I have attached an example below of mine,
with some key number and information changed of course.

X-Message-Status: n:0
X-SID-PRA: The Jack's <mike.johnson@comcast.net>
X-Message-Info: oG9qAjD2BNG0yVlB517PPKYPKCVoN6oMorhIcbX96X0/SC74auhSIaTg/ZUd/mys
Received: from sccrmhc14.comcast.net ([]) by bay0-mc10-f21.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668);
       Thu, 2 Aug 2007 07:00:44 -0700
Received: from MyHomePC (c-71-233-136-173.hsd1.ma.comcast.net[])
The last line is where you IP address will be. There is a bunch more to the source, but it is
all related to the email content, formatting, etc... What you want is pretty close to the top
of the page.

If you need more clarification, or do not want to leave your email client running, I sure another
alternative is out there.. This one is pretty easy though!

Author Comment

ID: 19617083

has simply text, so let's change this question around..... how can I download an html file from a command prompt.
LVL 18

Expert Comment

ID: 19617236
you can try lynx for win32 http://www.fdisk.com/doslynx/lynxport.htm
I don't think you can simply telnet to port 80 on whatismyip.org and get your ip.

What is this determination to use command line anyway?  seems like email would be the easiest way.

Expert Comment

ID: 19618994

The DOS option is usually a simple way to handle these thing in an automated fashion.
Low resources on the system, no services needed, and easy to set up a batch file
to run on a schedule.

The email option I outlined above is easy, but requires a few things:

1. You have Outlook or some other email software that you will not mind leaving
running on your home machine, and it can handle forwarding and rules.

2. A public email service like Hotmail to receive and view the information.

I'm not sure if you can view the header information (not sure if I am using the
correct term) in Outlook or another NON-WEB based email client? If so I would
like to learn about that myself! :o)

Expert Comment

ID: 19619261

DOS Commandline is fast and low on system resources. It is also very easy for
the intermediate user to set up a batch file and schedule.

The email idea I outline above is easy, but relies on two things.
1. You have an email client that can deal with rules and automatic forwarding,
and you don;t mind leaving that email client up and running on your machine
at home.
2. You are a hotmail user (or possibly another web based email user)

I'm not sure you could recover the email header information (if I am using the
correct term), from an email that comes in through outlook? If so I would be interested
in learning that as well! :o)

Expert Comment

ID: 19637867

MyWanIp 2.0

Also has the option to load on startup and to copy your WAN IP to the clipboard.

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
Many of the companies I’ve worked with have embraced cloud solutions due to their desire to “get out of the datacenter business.” The ability to achieve better security and availability, and the speed with which they are able to deploy, is far grea…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question