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 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
  • is an example IP address that I want to assign
  • is the netmask as an example
  • 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.

No comments: