Link to home
Start Free TrialLog in
Avatar of ramramcat
ramramcatFlag for United States of America

asked on

how to get the WAN external IP address my PC is using into a file that can be saved - using batch file commands?

how to get the WAN external IP address my PC is using into a file that can be saved - using batch file commands?
Avatar of Andy
Andy

Hi,

You could use a DNS request instead of HTTP request to find out your public IP:

C:\> nslookup myip.opendns.com. resolver1.opendns.com

Then pipe it into a file of your choice

Source: http://superuser.com/questions/165986/windows-command-that-returns-external-ip?newreg=71200a603a5746c8b9f766418e6d0dfc
Do you have access to your router?   The external IP address is there. It is just one number, so just write it down.
Although, unless you have a fixed IP, this can change.
Avatar of ramramcat

ASKER

Andy
Great so far....
But how do I "pipe it" into a file?
Really important to me.
Thank you
Hi,

just add
> c:\temp\externalip.txt
at the end of the command string:

nslookup myip.opendns.com. resolver1.opendns.com > externalip.txtx
got "non-authoritative answer" ??
Does the IP address returned show your public IP?

You can get your public IP from http://whatismyipaddress.com/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.