jeudi 28 avril 2016

BAT: Script that makes DNS changed automatically

Im from abroad USA and i pretty like Pandora and Netflix. That's why I insisted to change my DNS by one click. I wrote some code, but it doesnt work and i have no idea, why it doesn't. Here it is:

Echo On IF netsh interface ipv4 set dnsserver "Wi-Fi" source=dhcp==netsh interface ipv4 set dnsserver "Wi-Fi" source=dhcp DO ( netsh interface ipv4 add dnsserver "Wi-Fi" 46.101.36.120 netsh interface ipv4 add dnsserver "Wi-Fi" 46.101.149.135 index=2 ECHO DNS has changed to specific. ) ELSE ( netsh interface ipv4 set dnsserver "Wi-Fi" source=dhcp ECHO DNS has changed to automatic. ) ipconfig /flushdns

Even can't check what's wrong, because the cmd exits automatically. Each one of the command works, so did i mess up with the "if"? Help would be appreciated <3

Aucun commentaire:

Enregistrer un commentaire