I wrote this script for switching DNS servers of all currently enabled interfaces to specific address:
@echo off
:: Google DNS
set DNS1=8.8.8.8
set DNS2=8.8.4.4
for /f "tokens=1,2,3*" %%i in ('netsh int show interface') do (
if %%i equ Enabled (
echo Changing "%%l" : %DNS1% + %DNS2%
netsh int ipv4 set dns name="%%l" static %DNS1% primary validate=no
netsh int ipv4 add dns name="%%l" %DNS2% index=2 validate=no
)
)
ipconfig /flushdns
:EOF