回复 9# hulala - /*&cls
- @echo off&setlocal enabledelayedexpansion
- set "name=宽带连接"
- set "user=用户名"
- set "password=宽带密码"
- set "sleep=30"
- set "output=IP.ini"
-
- cd /d "%~dp0"
- if exist "%output%" (
- for /f %%a in ('type "%output%"') do set _#%%~a=1
- )
- :loop
- set "ip="
- rasdial "%name%" /disconnect
- rasdial "%name%" "%user%" "%password%"||goto loop
- >nul ping /n 3 0
- for /f %%a in ('cscript -nologo -e:jscript "%~f0"') do set ip=%%a
- :break
- if defined ip (
- echo;%ip%
- if not defined _#%ip% (
- set _#%ip%=1
- >>"%output%" echo;%ip%
- goto end
- )
- )
- timeout /t %sleep% /nobreak
- goto loop
- :end
- pause
- exit
- */
- var http=new ActiveXObject('Msxml2.ServerXMLHTTP');
- http.open('GET', 'http://ip.42.pl/raw', false);
- http.send();
- var html=http.responseText;
- var m=html.match(/(?:\d+\.){3}\d+/);
- if(m){WSH.echo(m[0]);}
复制代码
|