<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title> 您的IP地址 </title>
</head>
<body style="margin:0px"><center>您的IP地址是:[1.1.1.1] 来自:湖南省株洲市 电信</center></body></html>
1.1.1.1空格接回车
Originally posted by junchen2 at 2008-1-7 11:18 AM: sed "s/[ |\t]\+$//" ip.txtsed "s/[ |\t]\+$//" ip.txt >1.txt 空格变成了黑块 回车还是回车
set http=createobject("Microsoft.XMLHTTP")
ipp="http://www.ip138.com/ip2city.asp"
http.open "get",ipp,false
http.send
ss=bytes2BSTR(Http.responsebody)
ss=Replace(ss,vbcrlf,"")
Set re = New RegExp
re.Pattern = "(.+valign=""top"">)(.+\d+\.\d+\.\d+\.\d+)(.+)"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
rv = re.Replace(ss,"$2")
msgbox rv
Function bytes2BSTR(vIn)
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
for /f "delims=[] tokens=2" %a in ('wget -qO- http://www.ip138.com/ip2city.asp^|findstr /rc:"\[[0-9.]*\]"') do @set/p=my ip is [%a]<nul>1.txt
@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
del Getip.vbs
pause
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 "delims=[] tokens=2" %%a in ('wget -qO- http://www.ip138.com/ip2city.asp^|findstr /rc:"\[[0-9.]*\]"') do @set/p=%%a<nul>1.txt