is there a way to....


  1. Posts : 262
    MS Windows 7 Home Premium 64-bit
       #1

    is there a way to....


    is there a way to make a .bat file to automatically change my dns?
      My Computer


  2. Posts : 2,528
    Windows 10 Pro x64
       #2

    Sure, you can have it call netsh:
    Code:
    ::// Below sets a network card called "Local Area Connection" to use 192.168.0.1 and 192.168.0.2
    ::// Use netsh interface ipv4 show interfaces to get the "name" of the LAN connection(s):
    netsh interface ipv4 set dnsservers name="Local Area Connection" static 192.168.0.1 validate=no
    netsh interface ipv4 add dns "Local Area Connection" 192.168.0.2 index=2 validate=no
    
    ::// Below will set the interface back to getting the data from a DHCP server:
    netsh interface ipv4 set dnsservers name="Local Area Connection" dhcp
      My Computer


 

Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:40.
Find Us