Wednesday, 31 July 2013

New Favourite Thing in MS-DOS

Ok, not "new" given generations have been born and raised who've never even known MS-DOS exists, but sometimes,  batch files are what you need.

To do lots of nslookups, for instance.

Anyway, to take a list of IPs in a spreadsheet, it's child play to concatenate "nslookup " to the front, then put them into a notepad file that you make a .bat batch file.

The missing piece is redirecting the output to another file for easy processing based on the responses.

Here's what you do:

massive_nslookup.bat > outputfile.txt 2>&1

The 2 tells it to redirect standard output to the first argument, i.e. the output filename.

I found this solution at http://www.robvanderwoude.com/battech_redirection.php
Thanks Rob!

No comments: