Skip to content

Instantly share code, notes, and snippets.

@artkpv
Created October 11, 2017 11:07
Show Gist options
  • Save artkpv/50fd983262556d038561daedc43953ab to your computer and use it in GitHub Desktop.
Save artkpv/50fd983262556d038561daedc43953ab to your computer and use it in GitHub Desktop.
Changes DNS servers for IPv4 or clears them to ISP's ones
rem Changes DNS servers for IPv4 or clears them to ISP's ones
rem REQUIRES elevated access (Administrator)
rem see list at https://en.wikipedia.org/wiki/Public_recursive_name_server
@echo off
if [%1] equ [] wmic nicconfig where "(IPEnabled=TRUE)" call SetDNSServerSearchOrder ("")
if /I "%1"=="google" wmic nicconfig where "(IPEnabled=TRUE)" call SetDNSServerSearchOrder ("8.8.8.8","8.8.4.4")
if /I "%1"=="yandex" wmic nicconfig where "(IPEnabled=TRUE)" call SetDNSServerSearchOrder ("77.88.8.8","77.88.8.1")
if /I "%1"=="yandex.safe" wmic nicconfig where "(IPEnabled=TRUE)" call SetDNSServerSearchOrder ("77.88.8.88","77.88.8.2")
rem see https://www.opennic.org
if /I "%1"=="nic" wmic nicconfig where "(IPEnabled=TRUE)" call SetDNSServerSearchOrder ("130.255.73.90","82.196.9.45")
ipconfig /flushdns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment