I have a list of host names separated by new lines in a text file. I want to run netstat on each of those lines and write the output of all these commands to a text file. I know the netstat command will work on each line so thats not an issue.
Here is what I have so far in my .bat:
FOR /F "tokens=*" %%A in (fqdn.txt) do (
FOR /F "tokens=* USEBACKQ" %%F IN (`netstat %%A`) DO (
SET var=%%F
)
echo %var% >> test.txt
echo delim >> test.txt
)
All that happens is the netstat help is posted to the command line over and over and the text file fills up with:
ECHO is on.
delim
ECHO is on.
delim
ECHO is on.
delim
Thanks in advance for the help :)