Batch file to query IP addresses of server names listed in a text file (using NSLOOKUP & Ping)

Following guide shows how you can query  IP addresses of servers listed in a text file by using NSLOOKUP or Ping.



1. Create a batch file with following content.

2. Create a text file called servers.txt and list each server name on a separate line.

3. Result will list each server on a separate line along with it’s ip address in a file:┬áresults.txt



You can do the same thing by using PING command, following is a batch file: