2

Does anyone know of a way to simply output a website's IP address, that could be input in an excel sheet? Ex. www.cnn.com www.google.com www.superuser.com

IP1 IP2 IP3

Something in cmd would be fantastic.

7
  • 1
    Please always include your OS. Solutions very often depend on the Operating System being used. Are you using Windows, Linux, Unix, OSX, BSD? Which version?
    – terdon
    Oct 7, 2013 at 19:07
  • @terdon Win 7 Pro
    – user35983
    Oct 7, 2013 at 19:10
  • 1
    Most commands I know would only return the DNS information which isn't actually the address of the website but say a load balancer or cn server
    – Ramhound
    Oct 7, 2013 at 19:12
  • @Ramhound Would you know of a web resource similar to who.is where I could put in multiple landing pages and it output the IP?
    – user35983
    Oct 7, 2013 at 19:31
  • If you're not afraid of scripting it, I have an answer that is somewhat related and could easily be tweaked for you (note: instead of gethostbyaddr you'd tweak that)
    – nerdwaller
    Oct 7, 2013 at 19:35

2 Answers 2

4

NirSoft's FastResolver tool seems to do exactly what you want.

Type in a list of hostnames you want to get IPs for:

enter image description here

It will return the resolved IPs for the hostnames:

enter image description here

You can then copy & paste the returned data directly into Excel, or you can get an HTML report (in a table) for it.

enter image description here

You can also save the results in a variety of formats using the Save Items option:

enter image description here

You could save as CSV and open that with Excel, saving it in the format you desire.

It also works the other way (convert IP to hostname). You can also search a range of IPs and it will resolve the hostnames for those as well (useful for a local network!).

3
echo off  
cls  
set /p input= Website:  
for /f "tokens=1,2 delims=[]" %%A in ('ping /n 1 /w 1 %input% ^| find "Pinging"') do set ipaddress=%%B  
cls  
echo %ipaddress%  
pause > nul  

to loop the script, just do this:

echo off  

:loop  
cls  
set /p input= Website:  
for /f "tokens=1,2 delims=[]" %%A in ('ping /n 1 /w 1 %input% ^| find "Pinging"') do set ipaddress=%%B  
cls  
echo %ipaddress%  
pause 

goto loop  

Also, 'grep' should work for pulling a list of domains from a .txt. Just capture each line as a workable variable:

set site1=www.google.com  
set site2=www.whatever.com

for /f "tokens=1,2 delims=[]" %%A in ('ping /n 1 /w 1 %site1% ^| find "Pinging"') do set ipaddress=%%B   

You'll have to play around with your script a little bit..

2
  • Any idea on how to modify this to accept a list of domains? Possibly from a text file? If not, any way to look this do it asks again and again for website? This is very useful!
    – user35983
    Oct 7, 2013 at 20:32
  • "Grep" should work
    – ICE
    Jul 3, 2014 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .