(view source code of wanip.bat as plain text)
@ECHO OFF
:: Check Windows versionIF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: Check command line argumentsIF NOT "%~1"=="" GOTO Syntax
:: Check if WGET is availableWGET.EXE -V >NUL 2>&1 || GOTO Syntax
:: Display a headerECHO My WAN Connection:
ECHO.==================
:: Use WGET to retrieve your own WAN IP address from a:: web page, and NSLOOPKUP to get the host name as wellFOR /F %%A IN ('WGET.EXE -q -O- --no-check-certificate https://www.robvanderwoude.com/wanip.php 2^>NUL') DO (
NSLOOKUP.EXE %%A 2>NUL | MORE /E +3
):: TerminateGOTO:EOF
:SyntaxECHO.
ECHO WANIP.bat, Version 4.01 for Windows 7 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 Idea: Gregg Dotoli
ECHO Written by Rob van der Woude
ECHO https://www.robvanderwoude.com
page last modified: 2025-10-11; loaded in 0.0071 seconds