![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-09 02:21 |
47,811 topics / 349,895 posts / today 0 new / 48,253 members |
| DOS批处理 & 脚本技术(批处理室) » How can I obtain a public IP address |
| Printable Version 1,537 / 12 |
| Floor1 radem | Posted 2008-07-07 17:51 |
| 高级用户 Posts 383 Credits 691 | |
|
Dialing up through a router, using the ipconfig /all command doesn't get a public IP, only gets "Windows IP Configuration" and "Ethernet adapter 本地连接" two major items; if not through a router, you can get the ADSL public IP. Does it really not get a public IP using the ipconfig command when going through a router?
|
|
| Floor2 bat-zw | Posted 2008-07-07 17:58 |
| 金牌会员 Posts 1,276 Credits 3,105 | |
|
The tracert command can obtain such as:
tracert www.cn-dos.net |
|
| Floor3 radem | Posted 2008-07-07 19:26 |
| 高级用户 Posts 383 Credits 691 | |
|
Thanks, brother ZW. But the speed is a bit slow. Added 2 parameters to be better:
|
|
| Floor4 pusofalse | Posted 2008-07-07 22:59 |
| 银牌会员 Posts 646 Credits 1,604 | |
|
The first hop of tracert should be the IP of the gateway, not the public IP of the local machine
|
|
| Floor5 radem | Posted 2008-07-08 02:07 |
| 高级用户 Posts 383 Credits 691 | |
Originally posted by pusofalse at 2008-7-7 10:59 PM: Yeah~ tracert www.cn-dos.net Just gets the server IP of the domain www.cn-dos.net Then my this problem is still not solved ![]() |
|
| Floor6 pusofalse | Posted 2008-07-08 08:53 |
| 银牌会员 Posts 646 Credits 1,604 | |
|
Powerful WMIC really has management of IP.
wmic nicconfig get ipaddress /value |
|
| Floor7 HAT | Posted 2008-07-08 09:10 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Tracert only gets the server IP of the domain www.cn-dos.net? Maybe you didn't wait until tracert finished executing : )
|
|
| Floor8 radem | Posted 2008-07-08 13:25 |
| 高级用户 Posts 383 Credits 691 | |
Originally posted by HAT at 2008-7-8 09:10 AM: Tracing route to www.cn-dos.net 58.215.64.130 is not my public IP, but the server IP of www.cn-dos.net? |
|
| Floor9 HAT | Posted 2008-07-08 14:19 |
| 版主 Posts 5,017 Credits 9,023 | |
|
Sweat, all are timed out
|
|
| Floor10 tvzml | Posted 2008-07-08 23:42 |
| 初级用户 Posts 67 Credits 157 | |
|
@echo off
echo On Error Resume next >checkip.vbs echo Url="http://www.ip138.com/ip2city.asp" >>checkip.vbs echo Set NP = Createobject("Microsoft.XMLHTTP") >>checkip.vbs echo NP.Open "GET", url, False >>checkip.vbs echo NP.Send >>checkip.vbs echo Data=NP.responsebody >>checkip.vbs echo Set NP = Nothing >>checkip.vbs echo Data = bytes2BSTR(Data) >>checkip.vbs echo Here = InstrRev(Data, "Your IP address is: ", -1,0) >>checkip.vbs echo Data = Mid(Data,Here+9,13) >>checkip.vbs echo Hers = InstrRev(data, "<",-1,0) >>checkip.vbs echo Set ICEhack = CreateObject("InternetExplorer.Application") >>checkip.vbs echo ICEhack.Navigate("about:blank") >>checkip.vbs echo If Hers ^<^> 0 Then >>checkip.vbs echo ICEhack.document.parentwindow.clipboardData.SetData "text", Mid(Data,1,Hers-1) >>checkip.vbs echo Set WshSHell = WScript.CreateObject("WScript.Shell") >>checkip.vbs echo Set FSO = CreateObject("Scripting.FileSystemObject") >>checkip.vbs echo Set SCF = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(0),"ip.txt"),2,True) >>checkip.vbs echo SCF.Write(Data) >>checkip.vbs echo SCF.Close >>checkip.vbs echo Else >>checkip.vbs echo ICEhack.document.parentwindow.clipboardData.SetData "text", Data >>checkip.vbs echo Set WshSHell = WScript.CreateObject("WScript.Shell") >>checkip.vbs echo Set FSO = CreateObject("Scripting.FileSystemObject") >>checkip.vbs echo Set SCF = FSO.OpenTextFile(FSO.BuildPath(FSO.GetSpecialFolder(0),"ip.txt"),2,True) >>checkip.vbs echo SCF.Write(Data) >>checkip.vbs echo SCF.Close >>checkip.vbs echo End If >>checkip.vbs echo ICEhack.Quit >>checkip.vbs echo fso.DeleteFile(WScript.ScriptName) >>checkip.vbs echo Function bytes2BSTR(vIn) >>checkip.vbs echo strReturn = "" >>checkip.vbs echo For i = 1 To LenB(vIn) >>checkip.vbs echo ThisCharCode = AscB(MidB(vIn,i,1)) >>checkip.vbs echo If ThisCharCode ^< ^&H80 Then >>checkip.vbs echo strReturn = strReturn ^& Chr(ThisCharCode) >>checkip.vbs echo Else >>checkip.vbs echo NextCharCode = AscB(MidB(vIn,i+1,1)) >>checkip.vbs echo strReturn = strReturn ^& Chr(CLng(ThisCharCode) * ^&H100 + CInt(NextCharCode)) >>checkip.vbs echo i = i + 1 >>checkip.vbs echo End If >>checkip.vbs echo Next >>checkip.vbs echo bytes2BSTR = strReturn >>checkip.vbs echo End Function >>checkip.vbs checkip.vbs set/p n=<%windir%\ip.txt&cls echo External network IP: %n% pause>nul |
|
| Floor11 radem | Posted 2008-07-09 00:06 |
| 高级用户 Posts 383 Credits 691 | |
|
Thanks to the tenth floor. It's too complicated, might as well use the third-party wget.
|
|
| Floor12 pusofalse | Posted 2008-07-09 00:30 |
| 银牌会员 Posts 646 Credits 1,604 | |
|
@echo off
wget www.ip138.com/ips.asp&cls for /f "tokens=3 delims=: " %%a in ('findstr "Your IP address is" ips.asp') do echo External IP:%%a pause This version should have wget.exe. Search it... |
|
| Floor13 HAT | Posted 2008-07-09 01:14 |
| 版主 Posts 5,017 Credits 9,023 | |
|
wget.exe
http://upload.cn-dos.net/img/575.zip |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |