Set A Static IP Address On Windows 7 From The Command Line
Windows has traditionally been all about the GUI. However, in Windows 7 it’s possible to set a static IP address from the command line. Here’s how to do it.
Let’s say you want to give your Windows 7 system an IP address of 192.168.1.2, a subnet mask of 255.255.255.0, a default gateway of 192.168.1.254, and a DNS server address of 192.168.1.200. Go to an elevated command prompt (right-click on the command prompt icon and select Run As Administrator) and type these two commands:
netsh interface ipv4 set address “local area connection” static 192.168.1.2 255.255.255.0 192.168.1.254
netsh interface ipv set dnsservers “local area connection” static 192.168.1.200
These commands will configure the Local Area Connection with a static IP, netmask, gateway, and DNS server.
If you want to switch back to receiving your networking settings from a DHCP server, use these commands:
netsh interface ipv4 set address name=”local area connection” source=dhcp
netsh interface ipv4 set dnsservers name=”local area connection” source=dhcp
This will set the Local Area Connection back to using DHCP.