批量自动获取CNAME

@echo off
 color 1A
 setlocal enabledelayedexpansion
 echo *
 echo *  正在执行,请勿关闭窗口,请等待……..*
 echo *
 pushd "C:\Users\%username%\Desktop"
 if exist cname.txt (del cname.txt goto step1)
 :step1
 if exist report.txt (del report.txt goto step2)
 :step2
 if exist report1.txt (del report1.txt goto Ping)
 :Ping
 for /f %%i in (domain.txt) do ping %%i -n 1 >>report.txt
 findstr /i /c:"[" report.txt >report1.txt
 for /f "tokens=3" %%i in (report1.txt ) do echo %%i>>cname.txt
 del report.txt
 del report1.txt
 echo *
 echo *  CNAME已经获取完毕,按任意键退出……..*
 echo *
 pause
 exit

发表评论