I'm trying to put together a batch file, that will ping a website, and assign its ip to a variable - I've searched around, but haven't really been able to put something together. Can anyone shove me in the right direction.
Tim.
I'm trying to put together a batch file, that will ping a website, and assign its ip to a variable - I've searched around, but haven't really been able to put something together. Can anyone shove me in the right direction.
Tim.
If all you want to do is look up the addresses, you might want to use
nslookup
rather thanping
. Doing a search for "nslookup batch" gives you a bunch of results, including this one that looks like it should be fairly easy to adapt since it stores the result in variables.Same as @jeb answer, above, but without using
EnableDelayedExpansion
, just replace "www.google.com" with you favorite site or%variablename%
:You could try the ping command. The idea is to get the part between the [], of the ping output.