Does anyone know whether it is possible to return the IP address of a PC within VB Script – I want to create a script that my users can run that returns their IP address in a message box.
TIA,
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » Developers, developers, developers » Web design and development » VBS – IP Address
Not VB script, but would this javascript code from the JavaScript Source do?
Not VB script, but would this javascript code from the JavaScript Source do?
The last time I researched this, a couple of years ago, the answer was that you needed to use either Server Side Includes (SHTML) or ASP, if you are hosting on a Microsoft web server (IIS). An ordinary web page (HTM or HTML) does not seem to have access to the HTTP headers sent by the browser.
I wish I still had the code handy, because there was a neat trick. Oh wait, maybe I posted it. Searching… searching… got it! See post 129006. (Incidentally, that prank was extremely well received.)
By complete coincidence, I came across a VBS script that does the job and am posting for future reference.
You can find (and download) a script at http://www.billsway.com/vbspage/%5B/url%5D – look for the “Get IP Address” script. Note that all scripts on this site are copyrighted by Bill James and the usual disclaimers apply.
Cheers,
For anyone interested in this script, what it appears to do is run the command line ipconfig program (or in Windows 9x systems, winipcfg), capture its output to a file, and then extract the user’s IP address from there. In looking at my original post, I obviously was assuming that the script would have to run inside a browser. Running directly off the PC provides many more options.
For anyone interested in this script, what it appears to do is run the command line ipconfig program (or in Windows 9x systems, winipcfg), capture its output to a file, and then extract the user’s IP address from there. In looking at my original post, I obviously was assuming that the script would have to run inside a browser. Running directly off the PC provides many more options.
By complete coincidence, I came across a VBS script that does the job and am posting for future reference.
You can find (and download) a script at http://www.billsway.com/vbspage/%5B/url%5D – look for the “Get IP Address” script. Note that all scripts on this site are copyrighted by Bill James and the usual disclaimers apply.
Cheers,
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications