Quickest way to change an IP in windows

Quite often at work we need to manually change the IP of our laptops for testing various things. Since our laptops are not the quickest around town I quickly got bored of clicking on 5 different windows just to change IP. The I found the quite useful netsh command.

netsh interface ip set address name="Local Area Connection" static IP MASK GATEWAY 1

The above command would change the IP on the interface “Local area connection” to whatever values of IP/MASK?GATEWAY you define. Typing all that in rather than clicking (and waiting) for a few windows is maybe not as good so I’ve made a very simple bat script.

  1. Will ask for IP, mask and gateway then configure “Local Area Connection” and display its config to confirm
  2. Will configure “Local Area Connection” for DHCP then display the address it uses
  3. Manually configure the DNS servers used
  4. Show the current interface config
  5. Will relese and renew the DHCP address on “Local Area Connection”
  6. Asks for an address and pings it continually
  7. Asks for an address and pathpings to it (similar to traceroute)

Has worked for me in 2000, XP and windows 7 with no problems. It is provided as is though and you should use at your own risk etc. If you find any problems or suggestions I’d be happy to hear them. Grab the script [here] (the password is www.m00nie.com to work around the problem of bat files being on the naughty list).

m00nie 🙂