bat脚本
@echo off set "file=dns.txt" for /f "usebackq tokens=1* " %%a in ("%file%") do ( echo %%a nslookup -timeout=2 -type=mx -retry=2 %%a 114.114.114.114 | find "MX" )
shell脚本
for kk in `cat dns.txt` do mx=`dig -t mx $kk | grep -v "^;" | grep MX | awk -F" " '{print $6}'` echo $kk $mx done