China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-09 03:06
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How can I obtain a public IP address View 1,538 Replies 12
Original Poster Posted 2008-07-07 17:51 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
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?
Floor 2 Posted 2008-07-07 17:58 ·  中国 湖南 株洲 电信
金牌会员
★★★★
永远的学习者
Credits 3,105
Posts 1,276
Joined 2008-03-08 13:00
18-year member
UID 112398
Gender Male
Status Offline
The tracert command can obtain such as:
tracert www.cn-dos.net
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
radem +1 2008-07-07 19:27
批处理之家新域名:www.bathome.net
Floor 3 Posted 2008-07-07 19:26 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
Thanks, brother ZW. But the speed is a bit slow. Added 2 parameters to be better:

tracert -h 1 -w 1 www.cn-dos.net
Floor 4 Posted 2008-07-07 22:59 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
The first hop of tracert should be the IP of the gateway, not the public IP of the local machine
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 5 Posted 2008-07-08 02:07 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
Originally posted by pusofalse at 2008-7-7 10:59 PM:
The first hop of tracert should be the gateway's IP, not the local public network IP


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
Floor 6 Posted 2008-07-08 08:53 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
Powerful WMIC really has management of IP.
wmic nicconfig get ipaddress /value
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 7 Posted 2008-07-08 09:10 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Tracert only gets the server IP of the domain www.cn-dos.net? Maybe you didn't wait until tracert finished executing : )
Floor 8 Posted 2008-07-08 13:25 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
Originally posted by HAT at 2008-7-8 09:10 AM:
tracert only gets the server IP of the domain name www.cn-dos.net? Maybe you didn't wait for tracert to finish executing :)


Tracing route to www.cn-dos.net
over a maximum of 30 hops:

1 * * * Request timed out.
2 * * * Request timed out.
3 * * * Request timed out.
4 * * * Request timed out.
5 * * * Request timed out.
6 * * * Request timed out.
7 * * * Request timed out.
8 * * * Request timed out.
9 * * * Request timed out.
10 46 ms 45 ms 45 ms 58.215.64.130

Trace complete.
Press any key to continue. . .


58.215.64.130 is not my public IP, but the server IP of www.cn-dos.net?
Floor 9 Posted 2008-07-08 14:19 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Sweat, all are timed out
Floor 10 Posted 2008-07-08 23:42 ·  中国 浙江 杭州 电信
初级用户
★★
Credits 157
Posts 67
Joined 2007-05-13 11:03
19-year member
UID 88378
Gender Male
Status Offline
@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
Floor 11 Posted 2008-07-09 00:06 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
Thanks to the tenth floor. It's too complicated, might as well use the third-party wget.
Floor 12 Posted 2008-07-09 00:30 ·  中国 山东 淄博 联通
银牌会员
★★★
Credits 1,604
Posts 646
Joined 2008-04-13 23:39
18-year member
UID 115804
Gender Male
Status Offline
@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...
心绪平和,眼藏静谧,无比安稳的火... Purification of soul...Just a false...^_^
Floor 13 Posted 2008-07-09 01:14 ·  美国 惠普HP
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Forum Jump: