How to find your external ip address from the command line

I often need to know what the external IP address for a client is. Thus I’ve cobbled together the following script. Simply copy the code below into externalip.cmd and when run from the command prompt it will do two things for you:

  1. the script will display the external IP address
  2. the script will set the environment variable ExternalIP to be whatever that IP is

@echo off
:: Find out what the External IP address is
:: Create the .vbs file first
Echo Option Explicit >externalipaddress.vbs
Echo Dim http : Set http = CreateObject( "MSXML2.ServerXmlHttp" ) >>externalipaddress.vbs
Echo http.Open "GET", "", False >>externalipaddress.vbs
Echo http.Send >>externalipaddress.vbs
Echo Wscript.Echo http.responseText >>externalipaddress.vbs
Echo Set http = Nothing >>externalipaddress.vbs
:: run the resulting .vbs script and set the enviroment variable
for /f "skip=2 " %%G IN ('cscript externalipaddress.vbs') DO (Set ExternalIP=%%G)
:: Display the enviroment variable
Echo External IP is %ExternalIP%
:: tidy up and remove the temp file
del externalipaddress.vbs /q

Let me know if you find this useful, or if you can improve on it I’d love to hear from you.

Update on XPUnlimited

So some time ago I wrote a post about using XPUnlimited questioning it’s legality.

Today I’ve had another systems engineer tell me that it is legal. So I’ve spoken with the local distributor ( here in Australia and asked them to clarify this.

Part of their reply pointed me to the FAQ on the site:

It is legal to use XPUnlimited on top of Windows. If you want to know the details, read the license terms of Windows.

Certainly looking through the links and reading the paragraphs they cite makes me somewhat more comfortable about hearing of people who use it.

Stalwart & Star employees

Just read two interesting articles by Thomas Delong over at the Harvard Business School:

To be honest, I’ve pretty much always seen two types of workers, performers and under-performers, so reading these has opened my mind to a few new thoughts.
The first article on Stalwart workers debunks 5 myths:
  • Stars are smarter than Stalwarts.
  • Everybody is the same.
  • Everybody wants the same thing out of work.
  • Everybody wants to be promoted.
  • Everybody wants to be a manager.
It reminds of a saying that has had a lot of significance for me personally:

I am unique.
Just like everyone else.
We all have our strengths.
We all have our weaknesses.
That is what makes us unique.

Everybody does want the same thing. That is happiness. They way we each get there is somewhat different.

Reading the Registry from the Command Line

Often I need to check windows registry values, for example, to see if an addon is working.

From the Microsoft Windows command line (Start | run | cmd) it is easy to see what value a registry key has:

REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\MS Project\Addins\Mindjet.Mm8MsProject.AddIn.4" /v "LoadBehavior"

In this example above, we see if the Mindjet Mindmanager add-on is loaded or not in Microsoft Project.