IP Address List to DNS Name

December 12, 2009 at 03:31:34
Specs: Windows XP
I have text file with a list of IP addresses. I'd like to extract the equivalent DNS name of this list to a text file.

Help is very much appreciated. I have no idea about batch programming. I found a post here that is nearest to what I'd like to have.

Thank you so much


See More: IP Address List to DNS Name

Report •


#1
December 12, 2009 at 04:53:05
"extract the equivalent DNS name of this list to a text file."

Extract from what?


=====================================
Helping others achieve escape felicity

M2


Report •

#2
December 12, 2009 at 14:48:49
this might be what you want but it only works for computers that are live on the network. And, i just found out, the "ping"
that's on my winXp failed to give me the hostname, but since it works on my winMe, i tried copying ping.exe from the Me to the Xp and it worked. go figure... so you might have to cadge an old copy of ping.

@echo off && setlocal enabledelayedexpansion
for /f %%z in (iplist) do (
set ip=%%z
for /f "tokens=2,3" %%a in ('ping -a -n 1 !ip!' ^| find /i "pinging"') do (
echo %%a = %%b)
)


Report •

#3
December 12, 2009 at 23:15:14
nbrane,

Odd that XP ping won't give name. W2K does and it's more like XP thatn anything I know of.

Moving right along, I don't figure how your script will get DNS.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
December 12, 2009 at 23:27:45
ya they're different lineage: winXp ping is 17k, 8/4/2004 winME is 24k 6/1/2000. I'll keep the winME version thankyouverymuch.
i may have misconstrued what op wanted. ping -a just "resolves hostnames to ip addresses" on any successful pings, not DNS offerings (my home network is extremely simple: stackable hub, peer-to-peer, so i have no access to DNServer locally)

Report •

#5
December 13, 2009 at 01:15:59
Here's the MD5, size etc for w2k ping.exe:

f837281900f3793f6d38d5994a3ed319

04-07-03  12:00                 16,144 ping.exe

=============================
The only two utils that spring to mind to find DNS are whois & ipconfig.


=====================================
Helping others achieve escape felicity

M2


Report •

#6
December 13, 2009 at 02:18:15
Why not use nslookup instead of ping?

Report •

#7
December 13, 2009 at 02:53:54
Never heard of nslookup, but that seems promising.


=====================================
Helping others achieve escape felicity

M2


Report •

#8
December 15, 2009 at 00:02:34
hi guys,

thank you so much for your reply. I was able to managed case with the following:

1. simple batch file i got from this post also :)

:: DNS_Lookup.bat
@echo on

for /f "tokens=*" %%I in (iplist.txt) do call :nslookup %%I
goto :eof

:nslookup
nslookup %1 >> dnstest.txt
:: DONE

2.) I got the output from step 1 that looks like below:

Server: host1.domain.com
Address: 10.10.10.x

Server: host2.domain.com
Address: 10.10.10.y

... and so on ...

3.) And finally I used search and replace to get data that i need which looks like below:

host1.domain.com,10.10.10.x
host2.domain.com,10.10.10.y

------------------------------------------------------------------

it works though but the procedure was long. :( i know that this can be done by a batch file, i just don't know how to do it...sorry guys...i'm just starting DOS batch coding


Report •

#9
December 15, 2009 at 07:28:49
Try this to get straight to the host name:

for /f "tokens=*" %%I in (iplist.txt) do (
   for /f "tokens=1*" %%a in ('nslookup %%I ^| find "Name: "') do (
      echo %%b,%%I
   )
)


Report •


Ask Question