本帖最后由 pcl_test 于 2017-6-15 19:32 编辑
- @echo off
- :InIP
- for /f "tokens=4" %%i in ('route print ^| findstr 0.0.0.0.*0.0.0.0') do (
- set InternalIP=%%i
- goto :ExIP
- )
- :ExIP
- rem set "URL=http://city.ip138.com/ip2city.asp"
- set "URL=http://ip.6655.com/ip.aspx"
- >%temp%\download.vbs echo Set objDOM = WScript.GetObject("%URL%")
- >>%temp%\download.vbs echo Do Until objDOM.ReadyState = "complete"
- >>%temp%\download.vbs echo WScript.Sleep 100
- >>%temp%\download.vbs echo Loop
- >>%temp%\download.vbs echo WScript.Echo objDOM.DocumentElement.OuterText
- for /f "delims=" %%i in ('cscript //nologo //e:vbscript %temp%\download.vbs') do (
- set "PublicIP=%%i"
- )
- echo 内网IP:%InternalIP%
- echo 外网IP:%PublicIP%
- pause
复制代码
|