Public IP adress from command line

IP Address Questions and AnswersCategory: IP QuestionsPublic IP adress from command line
IPFreely asked 3 years ago

Hi folks,

I'm setting up a security system on my netbook and have come up against a wee problem. I've got a stealth webcam program that starts up with windows and emails images following a motion dection process. There's a timestamp on the option for the image but I'm trying to set up an IP stamp (which is not a default option).

So far I have a batch file set up with the following command:

ipconfig | find "IP Address" > "C:Program FilesYawcamextravars{ip}.txt"

The problem that's come to my attention is that as I'm currently connected to the internet via another PC (home network) all I'm getting is the internal network IP address. It occurs to me that if the blackguard who will potentially steal my beloved netbook does the same or connects via a router, the IP address stamp becomes redundant in terms of getting a rough fix on their location.

I've had a good look around for a solution, I have a rough idea of where to go from here but am lacking the finesse to achieve my aims.

There are a few questions I'm seeking answers to:

1) Is there a command that will return the public IP regardless of what type of network/router I am connecting through?
2) Can I pull the IP information provided by the main page on a site like this one using a batch file?
3) The webcam program is somehow able to identify the public IP and has it saved in it's settings file, can I extract that data from the settings .xml file?

1 Answers
Cody Robertson Staff answered 3 years ago

Hi F (again):

I have a (free) account with and registered the name So I can always obtain my network's WAN address by pinging that name (there's client software running to tell when my IP changes).

I suggest you use the exiv2 library (or exiv2 application) to embed this information into the image.


Know the answer? Login or sign up for an account to answer this question.
Sign Up