title: change network adapter DNS via bat file
body: <p>some years ago I wrote a small batch script to change DNS addresses automaticly for each network adapter present in the PC. after I wrote the batch script I converted it to exe. 
  Meanwhile I lost the code but now I need it again. </p>
  
  <p>I have found the exe file and was able to extract the cmd output:</p>
  
  <pre><code>@echo on    
  SETLOCAL EnableDelayedExpansion
  
      (
      SET adapterName=Ethernet adapter Ethernet:
       REM Removes "Ethernet adapter" from the front of the adapter name
       SET adapterName=!adapterName:~17!
       REM Removes the colon from the end of the adapter name
       SET adapterName=!adapterName:~0,-1!
       netsh interface ipv4 set dns name="!adapterName!" static 8.8.8.8 primary
       netsh interface ipv4 add dns name="!adapterName!" 8.8.4.4 index=2
       netsh interface ipv6 add dnsserver "!adapterName!" 2001:4860:4860::8888
      )
  
  
      FOR /F "tokens=* delims=:" %b IN ('IPCONFIG | FIND /I "WIRELESS LAN ADAPTER"') DO (
      SET WadapterName=%b
       REM Removes "Ethernet adapter" from the front of the adapter name
       SET WadapterName=!WadapterName:~21!
       REM Removes the colon from the end of the adapter name
       SET WadapterName=!WadapterName:~0,-1!
       netsh interface ipv4 set dns name="!WadapterName!" static 8.8.8.8 primary
       netsh interface ipv4 add dns name="!WadapterName!" 8.8.4.4 index=2
       netsh interface ipv6 add dnsserver "!WadapterName!" 2001:4860:4860::8888
      )
  
      ipconfig /flushdns
  </code></pre>
  
  <p>but I have no idea how to make it work again. I totaly forgot to write batch script.</p>