I'm trying to make a batch file that sets my DNS settings to local host if they are something else, and automatic if they are localhost. What I made so far is:
set var=1
if "%var%" == "1"
(
netsh interface ipv4 add dnsserver "Wi-Fi" address=127.0.0.1 index=1
set var=2
)
if "%var%" == "2"
(
netsh interface ip set dns “Wi-Fi” dhcp
set var=1
)
pause
Clearly, the variables are not permanent and don't "save". That's problem number 1. However, this script won't even change it to the localhost address. Additionally, if it did work the script has the clear setback of not detecting if the DNS settings have been changed by some other mean. I'm stuck, as my google-fu is not up to the challenge of figuring out what I'm doing wrong.