How to I make a script that does nslookup -q=ns for multiple websites and exports the results to a file

StackOverflow https://stackoverflow.com/questions/14772451

سؤال

I need to create a script that does outputs the results of nslookup -q=ns for multiple websites into a single file. I know how to make it do so for one webiste, it's just "nslookup -q=ns stackoverflow.com". But how do I do this with multiple websites that are listed after each other to a single file?

هل كانت مفيدة؟

المحلول

From the command line:

for /F %x in (websites.txt) do nslookup -q=ns %x

Inside a batch file you have to double the percents:

for /F %%x in (websites.txt) do @echo nslookup -q=ns %%x

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top