ip.bat 531 B

12345678910111213141516171819202122232425
  1. @echo off
  2. if exist ip.txt del ip.txt
  3. @echo off & setlocal
  4. set URL=http://checkip.dyndns.com/
  5. set G=%temp%\GetHTML.vbs
  6. 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%
  7. set ExtIP=
  8. for /f %%i in ('cscript //nologo %G% "%URL%"') do set "ExtIP=%%i"
  9. del %G%
  10. if not defined ExtIP echo Externe IP konnte nicht ermittelt werden. & goto :eof
  11. echo %ExtIP% >> ip.txt
  12. exit