第一种方法:
复制代码 代码如下:
@echo off
<"%~f0" more +5 >tmp.vbs
cscript //NoLogo /e:vbscript tmp.vbs %1>ip.txt
echo >nul && del tmp.vbs
goto:eof
set oDOM = WScript.GetObject("http://www.duosc.com/ip.aspx")
do until oDOM.readyState = "complete"
WScript.sleep 200
Loop
s=oDOM.documentElement.innerText
set re = New RegExp
re.Pattern="(\d+)\.(\d+)\.(\d+)\.(\d+)"
For Each m in re.Execute(s)
WScript.Echo m
Next
第二种方法:都是利用vbs代码
复制代码 代码如下:
@echo off
echo 正在连接,请稍等...
>Getip.vbs echo Set oDOM=WScript.GetObject("http://www.ip138.com/ip2city.asp"):Do Until oDOM.readyState="complete":WScript.sleep 200:Loop:WScript.echo oDOM.documentElement.outerText:Set oDOM=nothing
for /f "tokens=2,* delims=:" %%i in ('"cscript //nologo Getip.vbs"') do echo 你的IP地址是: %%i %%j>ip.txt
del Getip.vbs
复制代码 代码如下:
@echo off
<"%~f0" more +5 >tmp.vbs
cscript //NoLogo /e:vbscript tmp.vbs %1>ip.txt
echo >nul && del tmp.vbs
goto:eof
set oDOM = WScript.GetObject("http://www.duosc.com/ip.aspx")
do until oDOM.readyState = "complete"
WScript.sleep 200
Loop
s=oDOM.documentElement.innerText
set re = New RegExp
re.Pattern="(\d+)\.(\d+)\.(\d+)\.(\d+)"
For Each m in re.Execute(s)
WScript.Echo m
Next
第二种方法:都是利用vbs代码
复制代码 代码如下:
@echo off
echo 正在连接,请稍等...
>Getip.vbs echo Set oDOM=WScript.GetObject("http://www.ip138.com/ip2city.asp"):Do Until oDOM.readyState="complete":WScript.sleep 200:Loop:WScript.echo oDOM.documentElement.outerText:Set oDOM=nothing
for /f "tokens=2,* delims=:" %%i in ('"cscript //nologo Getip.vbs"') do echo 你的IP地址是: %%i %%j>ip.txt
del Getip.vbs
标签:
批处理,获取IP
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
内蒙古资源网 Copyright www.nmgbbs.com
暂无“批处理获取IP生成TXT文本的bat代码”评论...