Guest User

Untitled

a guest
Apr 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. @echo off
  2.  
  3. :: Google DNS Primary
  4. set DNS1=8.8.8.8
  5.  
  6. IF "%~1"=="set" (
  7. IF [%2] EQU [] goto noInterface
  8.  
  9. echo Setting DNS server to %DNS1% for interface: %2
  10.  
  11. netsh interface ip set dns "%~2" static %DNS1%
  12.  
  13. ipconfig /flushdns
  14. goto exit
  15. )
  16.  
  17. IF "%~1"=="unset" (
  18. IF [%2] EQU [] goto noInterface
  19.  
  20. echo Unsetting DNS server for interface: %2 to DHCP
  21.  
  22. netsh interface ip set dns "%~2" dhcp
  23.  
  24. ipconfig /flushdns
  25. goto exit
  26.  
  27.  
  28.  
  29. )
  30.  
  31. :noInterface
  32. echo syntax: set-dns.cmd ^<set/unset^> ^<interface_name^>
  33. echo example: set-dns.cmd set "Local Area Connection"
  34.  
  35. :exit
Add Comment
Please, Sign In to add comment