@echo off


if exist ip.txt del ip.txt

@echo off & setlocal 

set URL=http://checkip.dyndns.com/

set G=%temp%\GetHTML.vbs 

echo On Error Resume Next:Set Http=CreateObject("WinHttp.WinHttpRequest.5.1"):Http.Open "GET",WScript.Arguments(0),False:Http.Send:Q=Split(Http.ResponseText,":")(1):WScript.Echo Trim(Split(Q,"<")(0))>%G%

set ExtIP=

for /f %%i in ('cscript //nologo %G% "%URL%"') do set "ExtIP=%%i"

del %G%

if not defined ExtIP echo Externe IP konnte nicht ermittelt werden. & goto :eof 

echo %ExtIP% >> ip.txt


exit
