Code: Select all
netsh interface ipv4 add dns name=`"%Adapter%`" addr=`"%IP%`" index=%IPv4IndexVar%
So each command would be needed to be ran in separate windows(runwait). as I have my code now that is.
example using cloudflare DNS:
Code: Select all
netsh interface ipv4 set dns name="Wi-Fi" source="static" address="1.1.1.1"
netsh interface ipv4 add dns name="Wi-Fi" addr="1.0.0.1" index=2
netsh interface ipv6 set dns name="Wi-Fi" source="static" address="2606:4700:4700::1111"
netsh interface ipv6 add dns name="Wi-Fi" addr="2606:4700:4700::1001" index=2
netsh interface ipv4 set dns name="Ethernet" source="static" address="1.1.1.1"
netsh interface ipv4 add dns name="Ethernet" addr="1.0.0.1" index=2
netsh interface ipv6 set dns name="Ethernet" source="static" address="2606:4700:4700::1111"
netsh interface ipv6 add dns name="Ethernet" addr="2606:4700:4700::1001" index=2
ipconfig /flushdns
Code: Select all
runwait *RunAs %A_ComSpec% /c "%Command%",,Hide
Code: Select all
netsh interface ipv4 set dns name="Wi-Fi" source="static" address="1.1.1.1" & netsh interface ipv4 add dns name="Wi-Fi" addr="1.0.0.1" index=2 & netsh interface ipv6 set dns name="Wi-Fi" source="static" address="2606:4700:4700::1111" & netsh interface ipv6 add dns name="Wi-Fi" addr="2606:4700:4700::1001" index=2 & netsh interface ipv4 set dns name="Ethernet" source="static" address="1.1.1.1" & netsh interface ipv4 add dns name="Ethernet" addr="1.0.0.1" index=2 & netsh interface ipv6 set dns name="Ethernet" source="static" address="2606:4700:4700::1111" & netsh interface ipv6 add dns name="Ethernet" addr="2606:4700:4700::1001" index=2 & ipconfig /flushdns
What would I need to do/change in order to make this function?