Created
November 2, 2022 21:37
-
-
Save alessandromrc/8db2b3a4dc87fa3a3c4e387ea21a9f0e to your computer and use it in GitHub Desktop.
Auto Configurator for Cloudflare DNS made with batch for windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
Title Cloudflare DNS Auto Configurator | |
set first_server= "1.1.1.1" | |
set second_server= "1.0.0.1" | |
:checkPrivileges | |
NET FILE 1>NUL 2>NUL | |
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) | |
:getPrivileges | |
echo You have no admin rights. Please run me as administrator. | |
goto end | |
:gotPrivileges | |
echo You have admin rights. Continuing... | |
REM clearing up the cache | |
echo Clearing DNS Cache | |
wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder () | |
REM configure cloudflare as DNS server | |
echo Configuring Cloudflare as DNS server | |
wmic nicconfig where (IPEnabled=TRUE) call SetDNSServerSearchOrder (%first_server%, %second_server%) | |
goto end | |
:end | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment