I frequently change my IP address for various reasons. So I created a .cmd to set it to a static IP and one to set it back to DHCP.

The interface name can be found @ Control Panel\Network and Internet\Network Connections and must match .CMD, in this example I will use "Local Area Connection" but you could switch it to Wi-Fi easily etc etc.

To set static IP: [IP ADDRESS] [SUBNET] [GATEWAY]

Static IP

netsh interface ip set address name="Local Area Connection" static 192.168.2.42 255.255.255.0 192.168.2.254

 

 

To set back to DHCP:

DHCP

netsh interface ip set address name="Local Area Connection" source=dhcp

 

To change DNS entry 1:

1st-DNS

netsh interface ip set dns name="Local Area Connection" static 192.168.1.1

 

To change DNS entry 2:

2nd-DNS

netsh interface ip add dns name="Local Area Connection" 8.8.8.8 index=2

 

To set DNS back to DHCP:

DNS to DHCP

netsh interface ip set dnsservers name="Local Area Connection" source=dhcp

 

Disable or Enable Interface:

 netsh interface set interface name="Wi-Fi" admin=enabled/disabled