Search code examples
batch-filecommand-linenslookup

Batch file for printing out the results of nslookup on a list


I have a list of domain names that I want to ensure have the IP addresses that my records say that they do.

can I write a batch file that will take the list, run Nslookup on all the names in it, and then print the results in a .txt?

or better yet, actually compare the results to my records to check the results for me?


Solution

  • Here's a handy batch file I use:

        REM @echo off
        del C:\results.txt 2>nul
        for /f "delims=" %%a in (c:\servers.txt) do NSLOOKUP %%a >> c:\results.txt
        exit