vbs和批处理的差别之一:
批处理没有自带的下载命令;
纯批处理的话就是用wget了。
P.S. 楼上的有语法错误(
貌似复制——粘贴时换行出问题了),修改了一下:
@echo off
echo Set objXML = WScript.GetObject("http://www.apnic.net/")>apnic.vbs
echo While objXML.readyState = "loading">>apnic.vbs
echo WScript.Sleep 100>>apnic.vbs
echo Wend>>apnic.vbs
echo Set coll = objXML.getElementsByTagName("td")>>apnic.vbs
echo WScript.Echo coll(0).innertext>>apnic.vbs
echo Set objXML = Nothing>>apnic.vbs
for /f "delims=: tokens=2" %%i in ('cscript //nologo apnic.vbs') do echo 本机外网IP是 %%i>ip.txt
del apnic.vbs /q
Last edited by dikex on 2008-3-18 at 03:01 PM ]
One of the differences between VBS and batch processing:
Batch processing does not have a built-in download command;
In the case of pure batch processing, it is to use wget.
P.S. The above has a grammar error (
It seems there was an issue with line breaks during copy - paste), modified as follows:
@echo off
echo Set objXML = WScript.GetObject("http://www.apnic.net/")>apnic.vbs
echo While objXML.readyState = "loading">>apnic.vbs
echo WScript.Sleep 100>>apnic.vbs
echo Wend>>apnic.vbs
echo Set coll = objXML.getElementsByTagName("td")>>apnic.vbs
echo WScript.Echo coll(0).innertext>>apnic.vbs
echo Set objXML = Nothing>>apnic.vbs
for /f "delims=: tokens=2" in ('cscript //nologo apnic.vbs') do echo 本机外网IP是 %%i>ip.txt
del apnic.vbs /q
Last edited by dikex on 2008 - 3 - 18 at 03:01 PM ]