判断DNS并自动切换

@echo off
 CLS
 ECHO.
 :init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
 :checkPrivileges
 NET FILE 1>NUL 2>NUL
 if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
 ECHO.
 ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 ECHO args = "ELEV " >> "%vbsGetPrivileges%"
 ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
 ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 ECHO Next >> "%vbsGetPrivileges%"
 ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B
 :gotPrivileges
 setlocal & pushd .
 cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
 ::判断本地连接 赋值a
 for /f "tokens=2,3" %%i in ('ipconfig /all^|findstr /r "以太网适配器"') do echo %%i %%j >net-name.txt
 for /f "tokens=1 delims==:" %%d in (net-name.txt) do set a=%%d

::判断当前DNS 赋值c
 for /f "tokens=15" %%i in ('ipconfig /all^|findstr /r "DNS"') do echo %%i >DNS.txt
 for /f "tokens=1 delims==." %%h in (DNS.txt) do set c=%%h

::比较当前DNS
 if "%c%"=="8" (goto ToAliDNS) else ( if "%c%"=="223" ( goto ToGoogleDNS ))

::请根据实际情况更改以下内容
 :ToGoogleDNS
 echo Google DNS
 color 1A
 echo ***
 echo 正在修复,请稍后…….
 echo ***
 netsh interface ip set dns name="%a%" source=static addr=8.8.4.4
 netsh interface ip add dns "%a%" 8.8.8.8
 goto EXIT

:ToAliDNS
 echo ALI DNS
 color 1A
 echo ***
 echo 正在修复,请稍后…….
 echo ***
 netsh interface ip set dns name="%a%" source=static addr=223.5.5.5
 netsh interface ip add dns "%a%" 223.6.6.6
 goto EXIT

:EXIT
 ipconfig /flushdns
 echo *
 ipconfig /flushdns
 echo *
 ipconfig /flushdns
 del net-name.txt
 del DNS.txt
 echo *
 echo 修复已完成,祝您游戏愉快
 echo *
 echo 请按任意键退出
 echo **
 pause
 exit

自动修改DNS

@echo off
 CLS
 ECHO.
 :init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
 :checkPrivileges
 NET FILE 1>NUL 2>NUL
 if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
 ECHO.
 ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 ECHO args = "ELEV " >> "%vbsGetPrivileges%"
 ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
 ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 ECHO Next >> "%vbsGetPrivileges%"
 ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B
 :gotPrivileges
 setlocal & pushd .
 cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)
 ::判断本地连接 赋值a
 for /f "tokens=2,3" %%i in ('ipconfig /all^|findstr /r "以太网适配器"') do echo %%i %%j >DNS.txt
 for /f "tokens=1 delims==:" %%d in (DNS.txt) do set a=%%d
 ::请根据实际情况更改下面三行
 color 1A
 echo ***
 echo 正在修复,请稍后…….
 echo ***
 netsh interface ip set dns name="%a%" source=static addr=223.5.5.5
 netsh interface ip add dns "%a%" 114.114.115.115
 ipconfig /flushdns
 ipconfig /flushdns
 ipconfig /flushdns
 del DNS.txt
 pushd "C:\Windows\System32\drivers\etc"
 echo.>hosts
 echo *
 echo *修复已完成,祝您游戏愉快 *
 echo *
 echo **
 echo 请按任意键退出
 echo **
 pause
 exit

输入域名自动绑定hosts

@echo off
 CLS
 ECHO.
 :init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
 :checkPrivileges
 NET FILE 1>NUL 2>NUL
 if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
 ECHO.
 ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 ECHO args = "ELEV " >> "%vbsGetPrivileges%"
 ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
 ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 ECHO Next >> "%vbsGetPrivileges%"
 ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B
 :gotPrivileges
 setlocal & pushd .
 cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)

 color 1A
 set /p domain=请输入您要修复的域名,并按确定键:

:change
 find /i "%domain%" C:\Windows\System32\drivers\etc\hosts>nul
 if "%errorlevel%"=="0" goto view
 if "%errorlevel%"=="1" goto repair2

:view
 echo 您已修复过此域名,是否重新修复
 echo 重新修复请输入“y”,否则请直接关闭程序
 set /p value=请输入:
 if "%value%"=="y" goto repair1
 if "%value%"=="Y" goto repair1

:repair1
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 find /v "%domain%" hosts.new
 move hosts.new hosts>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 修复已完成,祝您游戏愉快!
 pause
 exit

:repair2
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 修复已完成,祝您游戏愉快!
 pause
 exit

批量自动PING

@echo off
 color 1A
 setlocal enabledelayedexpansion
 echo *
 echo *  正在执行,请勿关闭窗口,请等待……..*
 echo *
 pushd "C:\Users\%username%\Desktop"
 if exist result.txt (del result.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:"Ping" report.txt >report1.txt
 for /f "tokens=3,4" %%a in (report1.txt ) do echo %%a %%b>>result.txt
 del report.txt
 del report1.txt
 echo * echo 域名检测完毕,请查看桌面result.txt…….. echo *
 pause
 exit

批量自动获取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

根据条件绑定hosts

@echo off
 CLS
 ECHO.
 :init
 setlocal DisableDelayedExpansion
 set "batchPath=%~0"
 for %%k in (%0) do set batchName=%%~nk
 set "vbsGetPrivileges=%temp%\OEgetPriv_%batchName%.vbs"
 setlocal EnableDelayedExpansion
 :checkPrivileges
 NET FILE 1>NUL 2>NUL
 if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
 :getPrivileges
 if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
 ECHO.
 ECHO Set UAC = CreateObject^("Shell.Application"^) > "%vbsGetPrivileges%"
 ECHO args = "ELEV " >> "%vbsGetPrivileges%"
 ECHO For Each strArg in WScript.Arguments >> "%vbsGetPrivileges%"
 ECHO args = args ^& strArg ^& " " >> "%vbsGetPrivileges%"
 ECHO Next >> "%vbsGetPrivileges%"
 ECHO UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%vbsGetPrivileges%"
 "%SystemRoot%\System32\WScript.exe" "%vbsGetPrivileges%" %*
 exit /B
 :gotPrivileges
 setlocal & pushd .
 cd /d %~dp0
 if '%1'=='ELEV' (del "%vbsGetPrivileges%" 1>nul 2>nul & shift /1)

color 1A
 :firstinput
 echo  echo 请输入需要修复的平台名称的拼音       * echo 
 echo 例如平台名称为"百度",则输入"baidu"  *
 echo **
 set /p product=请输入拼音,并按确定键:
 if "%product%"=="longba" ( goto longbachange ) else ( if "%product%"=="qianying" ( goto qianyingchange ) else ( goto errorinput ))

:longbachange
 set /p domain=请输入要修复的"%product%"的域名,并按确定键:
 find /i "%domain%" C:\Windows\System32\drivers\etc\hosts>nul
 if "%errorlevel%"=="0" goto longbaview
 if "%errorlevel%"=="1" goto longbarepair2

:longbaview
 echo  echo 您已修复过此域名,是否重新修复       * echo ***
 echo 重新修复请输入“y”,退出请输入"n"或直接关闭程序 *
 echo ***
 set /p value=请输入:
 if "%value%"=="y" goto longbarepair1
 if "%value%"=="n" goto allexit

:longbarepair1
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 find /v "%domain%" hosts.new
 move hosts.new hosts>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:longbarepair2
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:qianyingchange
 set /p domain=请输入要修复的"%product%"的域名,并按确定键:
 find /i "%domain%" C:\Windows\System32\drivers\etc\hosts>nul
 if "%errorlevel%"=="0" goto qianyingview
 if "%errorlevel%"=="1" goto qianyingrepair2

:qianyingview
 echo  echo 您已修复过此域名,是否重新修复       * echo ***
 echo 重新修复请输入“y”,退出请输入"n"或直接关闭程序 *
 echo ***
 set /p value=请输入:
 if "%value%"=="y" goto qianyingrepair1
 if "%value%"=="n" goto allexit

:qianyingrepair1
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 find /v "%domain%" hosts.new
 move hosts.new hosts>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:qianyingrepair2
 pushd "C:\Windows\System32\drivers\etc"
 copy hosts hosts.bak>nul
 echo,>>hosts
 echo 119.42.34.47  %domain%>>%Windir%\system32\drivers\etc\hosts
 echo 
 echo 修复已完成,祝您游戏愉快!       *
 echo 
 echo 请按任意键退出!                 *
 echo 
 pause
 exit

:allexit
 echo 
 echo 您已终止修复程序,按任意键退出! *
 echo 
 pause
 exit

:errorinput
 echo *
 echo 您输入的平台名称有误!                  *
 echo *
 echo 请联系平台客服人员确认正确名称          *
 echo 
 echo 按确定键重新输入,退出请输入"n"或直接关闭程序    *
 echo 
 set /p what=请输入:
 if "%what%"=="n" goto allexit
 pause
 goto firstinput