Cmd.exe / .bat help

Joined
Oct 9, 2010
Messages
1
Reaction score
0
So I've been trying to make a .bat file that basically does this:
-find the IP of a user inputted website URL.
-take that value of w.x.y.z and input it into a web browser.
my main issue here is taking the outputted IP and putting it to use in the same .bat file.
also, the user input is a bit tricky, im kinda new at this.
any code / explanation to help me out?
right now im using win 7 but ill end up making it for XP so either or both versions would be helpful. thanks!

edit: also i just realized that this probably should go in the support forum, but at the time i was thinking support as in non-programming stuff, so.. sorry!
 
Last edited:

Ian

Administrator
Joined
Oct 17, 2008
Messages
3,484
Reaction score
632
General discussion is probably fine for this, as it's more of a programming question than support issue :).

I understand what you're trying to do, but I don't know the programming knowledge to create the code. I can suggest a few thing that may help though :)

First, you can use the following code to allow input of a domain:

Code:
SET /P PINGDOMAIN=Enter Domain:
Next you'll need to figure out a way to capture the IP of a domain that you enter in to the script. I guess using ping would be the easiest. You can then output the full result to a temp file:

ping %PINGDOMAIN% > temp.txt
Then you'll need to capture the IP as a variable, using something like this and this to search through the temp.txt file and allow you to use the IP in the batch file. This is a little complicated the first time you use the command, but it's very logical to figure out - I'm sure there are some experts here that will know an easier way of captureing the IP.

Once you've got the IP stored as a variable, you can then just launch IE as follows (assuming %IPADDRESS% is your variable name):

C:\Program Files\Internet Explorer\iexplore.exe %IPADDRESS%
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top