Todd and Margo Chester wrote:
Hi Pegisus,
This is my final version of your code. Be careful of
any word wrapping on the wget line (see comments)
-Todd
@echo off
rem Get External (Public) IP address
rem Note: requires wget.exe, which can be downloaded
rem from
http://users.ugent.be/~bpuype/wget/#download
rem code taken from a news reply by Pegasus (MVP)
:Start
set wget=.\wget.exe
if exist %wget% goto GetIP
set wget=C:\NtUtil\wget.exe
if exist %wget% goto GetIP
set wget=C:\Tools\wget.exe
if exist %wget% goto GetIP
echo Critical error (Bummer):
echo.
echo Unable to locate wget.exe in .\, C:\NtUtil, C:\Tools
echo wget can be downloaded from
http://users.ugent.be/~bpuype/wget/#download
echo.
goto End
:GetIP
if exist index.html del index.html
rem the follow is one single line. Remove any word wraps
%wget%
www.whatismyip.com -onul
for /F "tokens=4 delims=< " %%a in ('type index.html ^| find /i "your
ip is"') do echo External IP=%%a
rem end single line
if exist index.html del index.html
echo.
:End
pause