Batch file for resolving ipadress to hostname

Microsoft Windows xp professional w/serv...
August 16, 2010 at 20:50:34
Specs: Windows XP, 2.8 GHz
Hi Team,

I have a batch file where it pings all ipaddress from a txt file called "systemname.txt" and gives the results like ping results. It will create two files either online or offline txt files.

Now i want to resolve the ip address to the hostname with the same output.

Please help me..

my batch file as follows.

@echo off
del online.txt
del offline.txt
for /f "tokens=1" %%i in (systemname.txt) do call :process %%i

goto :exit


set system=%1

echo Processing %system%

ping -n 1 %system%|findstr -i "Reply"

if "%errorlevel%"=="0" (goto :report) else (goto :error)

goto :EOF

echo %system% >> ONLINE.txt

goto :EOF


echo %system% >> OFFLINE.txt

goto :EOF




See More: Batch file for resolving ipadress to hostname

Report •

August 24, 2010 at 09:35:09
You have a list of IP's, and you want to know if there are pointer records to those IP's? Here's your starting point:
nslookup -type=ptr <IP Address>

Report •

August 24, 2010 at 19:00:44
You could change "ping -n 1 %system%|findstr -i "Reply"" to "ping -n 1 %system% /a |findstr -i "Reply"" The "/a" will show the Ip's unless it's yourself

Nom Nom Nom

Report •

August 24, 2010 at 21:44:42
Thanks for your reply.. But its not working.. Could please explain once again.

I need the hostnames of the systems which are online ...

Report •

Related Solutions

Ask Question