@ECHO OFF :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO Syntax :: Check command line arguments IF NOT "%~1"=="" GOTO Syntax :: Check if WGET is available WGET.EXE -V >NUL 2>&1 || GOTO Syntax :: Localize variables SETLOCAL :: Use WGET to download an "external" web page to retrieve your own WAN IP address WGET.EXE -O "%Temp%.\browsertest.html" http://www.maptrax.com.au/standardscompliance/browsertest/ >NUL 2>&1 :: Parse the info from the downloaded web page and store the address in a variable FOR /F "tokens=5 delims=<>" %%A IN ('TYPE "%Temp%.\browsertest.html" ^| FIND /I "Your IP address:"') DO FOR %%B IN (%%A) DO SET WAN_IP_Address=%%B :: Display the result, using NSLOOKUP to show the host name too ECHO My WAN Connection: ECHO.================== NSLOOKUP.EXE %WAN_IP_Address% 2>NUL | MORE /E +3 :: Cleanup and terminate DEL "%Temp%.\browsertest.html" ENDLOCAL GOTO:EOF :Syntax ECHO. ECHO WANIP.bat, Version 1.00 for Windows NT 4 and later ECHO Display your WAN connection's IP address and host name ECHO. ECHO Usage: WANIP ECHO. ECHO Note: This batch file uses WGET, available at ECHO http://www.gnu.org/software/wget/wget.html ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com ECHO Idea: Gregg Dotoli