I've got some customers who should use a specific IP in their network adapter, but manually setting it is a pain sometimes. So I would like to know if there's a shell command / batch that allows me to set it without having to open "Network" -> "Adapter Setting" -> "Ipv4" -> "Ip Address".



The command is: to change IP and default gateway:

netsh int ip set address "local area connection" static 1

to change DNS:

netsh int ip set dns "local area connection" static primary 

This is assuming 3 things.

1) The network adapter you're trying to change the IP for is "local area connection". It could also be "local area connection 2" or "wireless network connection". Look in your control panel for the correct name

2) The IP you want to set is, change this to whatever IP to want to use.

3) The default gateway and dns are the same IP. If you are using some kind of router they usually are. Change this to match your network config found with the command ipconfig /all

| improve this answer | |
  • appreciate it. Can I also get the adapter and store in a variable? To fully automate it? – dan Jan 8 '14 at 14:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.