Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Google DNS Primary
- set DNS1=8.8.8.8
- IF "%~1"=="set" (
- IF [%2] EQU [] goto noInterface
- echo Setting DNS server to %DNS1% for interface: %2
- netsh interface ip set dns "%~2" static %DNS1%
- ipconfig /flushdns
- goto exit
- )
- IF "%~1"=="unset" (
- IF [%2] EQU [] goto noInterface
- echo Unsetting DNS server for interface: %2 to DHCP
- netsh interface ip set dns "%~2" dhcp
- ipconfig /flushdns
- goto exit
- )
- :noInterface
- echo syntax: set-dns.cmd ^<set/unset^> ^<interface_name^>
- echo example: set-dns.cmd set "Local Area Connection"
- :exit
Add Comment
Please, Sign In to add comment