Wednesday, October 25, 2006

Windows XP - How to Set IP Address From Script

You may run into a sitaution where you move your laptop computer around different networks where static address must be configured. This can be accomplished very easily on Windows XP using the "netsh" command. What you do is to write a command similar to the following in a .BAT file then just double click that .BAT file. (Note that due to the browser formatting, following may look like two or three lines but it is supposed to be type in as a single line command.)

netsh interface ip set address name="Local Area Connection" static 192.168.0.68 255.255.255.0 192.168.0.1 1


What they mean:
  • netsh is the command already built into your XP
  • interface ip set address is the command to set a fixed IP.
  • name="Local Area Connection" is the name of the interface. This is the name of the interface that you can see on your Networks window from the Control Panel.
  • static means it is a static IP
  • 192.168.0.68 is an example IP address that I want to assign
  • 255.255.255.0 is the netmask as an example
  • 192.168.0.1 is the gateway as an example
  • 1 is the routing metric, you can almost always leave this as 1
For more information you can type in netsh, hit return then type a ? then hit return.
Post a Comment