Changing Gateway and DNS addresses with batch file

8,375

Take a look at the netsh command:

netsh interface ip set address name="Local Area Connection" static IPadress SubnetMask GATEway 1

netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 10.10.23.236 1

change the values to what you need.

Share:
8,375

Related videos on Youtube

mr_mohamed
Author by

mr_mohamed

Updated on September 18, 2022

Comments

  • mr_mohamed
    mr_mohamed over 1 year

    I'm having a little crisis every time I have to change the gateway in order to access different sites from my workplace. It's time consuming and I'd be really glad if someone provides me with a script that would change the Default Gateway address as well as DNS address automatically by clicking a .bat file.

    • There are two Default Gateway addresses : 10.10.23.236 & 10.10.23.1 (I need to switch between these two gateways constantly and it's really getting time consuming)
    • DNS Server addresses are : Primary - 10.1.0.40, Alt - 10.1.0.50 Primary - 203.115.0.246, Alt - 203.115.0.247
    • Canadian Luke
      Canadian Luke almost 10 years
      What version of Windows?