MS-DOS Utility :: getip.vbs
getip.vbs displays your internet IP address. It works regardless of whether or not you are using a router. If you are connected to the internet using a router, it will display your router's IP address. If you are connected directly without a router, it will display your computer's IP address. In either case, it displays the internet IP address that the outside world sees.
Tip: You can determine your internet IP address by simply visiting WhatIsMyIP.com or checkip.dyndns.org. If you are using a router, these websites will show the address of your router, not the local IP address of your computer.
Tip: If your computer is directly connected to the internet (without a router), you can simply use the command:
ipconfig diag show ip
Follow the steps outlined below to use the getip.vbs Visual Basic script:
Click here and save as getip.txt (remember where you saved it!).
Open the folder where you just saved getip.txt.
To ease any security concerns you may have,
double-clickgetip.txt to see its contents. For an explanation, see below: How getip.vbs Works.
In the foler, right-click on the file and rename it to getip.vbs (.vbs files are Visual Basic files).
Change directory to where you saved the file (use the cd command to change directory).
Type: cscript getip.vbs
If a firewall security warning appears that says something like "A program is attempting to connect to the internet, C:\WINDOWS\system32\cscript.exe, Microsoft (R) Console Based Script Host", click "Allow Once" (or similar firewall command). See below: How getip.vbs Works.
Tip: For security, grant cscript.exe only
one-timeaccess (i.e.: "Allow Once" or similar firewall command); you should not allow permanent access (i.e.: "Allow" or "Allow Always" or similar firewall command).
Tip: You can hide the copyright notice that cscript outputs by using the //nologo flag (Note: two // characters). Type:
cscript //nologo getip.vbs
Contents of getip.vbs:
'-- http://www.c3scripts.com/tutorials/msdos/ Dim s With CreateObject("MSXML2.XMLHTTP") .open "GET", "http://checkip.dyndns.org/", False .send s = .ResponseText End With Dim x x = InStr(s, ":") If x > 0 Then s = Mid(s, x + 2) x = InStr(s, "<") If x > 0 Then s = Left(s, x - 1) WScript.Echo(s) End If End If
getip.vbs is a small program that works by accessing http://checkip.dyndns.org/ to obtain the IP address that the outside world sees. You can access that website in your web browser to see what it reports. That website simply displays a sentence such as the following:
Current IP Address: 188.8.131.52
getip.vbs takes that sentence and displays what appears after the : character.
- Displays internet configuration, including IP address.