
June 3rd, 2008, 05:52 AM
|
 |
SץsAםмιи & Wяιτєя
|
|
Join Date: Sep 2004
Location: Romania - Târgu Mureş - the one and only
|
|
Quote: | Originally Posted by Mad Professor type ipconfig /all | That won't find your external IP address if you aren't connected directly to the Internet (say, via a router, ICS, etc.). However, Mad Professor is certainly correct since you asked for the IP address of the computer. And in that case, let it be local-- it is your computer's, definitely.
In order to find your currently active external IP address from the "cmd" then you need to actually write a tiny and useful WSH script. For example, your WSH script could connect to "checkip.dyndns.org", check its reply, and then trim the received packet so that only the IP address remains. Then there you will have it--only the IP address.
On how to accomplish this, please check out Robert Dunham's ( Nilpo) article called Handling Live Web Content in WSH. The following script is thoroughly commented, described, and explained in the said article. So please refer back to the aforementioned article.
vb Code:
Original
- vb Code |
|
|
|
result = getIP() Wscript.Echo "Your external IP address is: " & result Wscript.Quit Function getIP() Set objxmlHTTP = CreateObject("Microsoft.XMLHTTP") Call objxmlHTTP.open("GET", "http://checkip.dyndns.org", False) objxmlHTTP.Send() strHTMLText = objxmlHTTP.ResponseText Set objxmlHTTP = Nothing If strHTMLText <> "" Then varStart = instr(1, strHTMLText, "Current IP Address:", vbTextCompare) + 19 If varStart Then varStop = instr(varStart, strHTMLText, "</body>", vbTextCompare) If varStart And varStop Then strIP = mid(strHTMLText, varStart, varStop - varStart) Else strIP = "Unavailable" End If getIP = trim(strIP) End Function
Then you can execute this script (from a CMD, if need be) and a message box will pop up displaying your EXTERNAL IP address.
__________________
“Greatness, combined with the hint of a 24-carat lifestyle, is within us striving to make it through, craving for attention,
and in the end, recognition, leaving a record worthy of biography on forging success stories.” —ME
Check out MadHyeNa's Website & Article Index. Visit Nilpo.com - Ask the Windows Guru!™
I succeed, conquer, and achieve, therefore I am.™
Last edited by Nilpo : June 4th, 2008 at 02:45 AM.
|