XP: Set or configure static network IP address wtih netsh from command line

Posted July 18, 2006 by Quinn McHenry in Windows networking

Setting the IP address from the command line from XP is simple with the netsh command. This is ideal for use in batch files.


To set the following settings on the network interface “Local Area Network”

IP address: 192.168.50.100
Subnet mask: 255.255.255.0
Gateway: 192.168.50.1

use the following command (one line):

netsh int ip set address name="Local Area Connection" source=static 192.168.50.100 255.255.255.0 192.168.50.1 1

The order of the values in the command is IP address, subnet mask, and gateway. The 1 at the end is a routing metric for the gateway address. The value 1 will work for most circumstances.

 

About Quinn McHenry

Quinn was one of the original co-founders of Tech-Recipes. He is currently crafting iOS applications as a senior developer at Small Planet Digital in Brooklyn, New York.
View more articles by Quinn McHenry

The Conversation

Follow the reactions below and share your own thoughts.