Click here for important information about

How to ping static IP's in Batch?

September 17, 2011 at 08:01:48
Specs: Windows Vista
Can someone give me an idea how to ping static IP's in Batch and if there's a response it will give
me output of that IP and its hostname.. Example output: PC1 =, PC2= etc... Thnx in advance..

See More: How to ping static IPs in Batch?

September 19, 2011 at 05:46:34
If you are looping through a list of ip addresses, you would probably have to loop through it twice. Once to ping the list and record which machines respond like this:

for /F "tokens=*" %%A in (c:\list.txt) do if exist \\%%A\C$\*.* echo %%A >> c:\online_hosts.txt

Then you could loop through online_hosts.txt to nslookup each ip address like this:

for /F "tokens=*" %%A in (c:\online_hosts.txt) do nslookup %%A >> result.txt

Report •
Related Solutions

Ask Question