• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 514
  • Last Modified:

Command Live Instruction to change IP Address - Windows 7


I wish to change the gateway of my Windows 7 PC using command line instruction. From time to time i need to choose a different router and keep looking for quick & simple ways to achieve this - how can i do it?

1 Solution
You can do that with netsh.exe (see http://technet.microsoft.com/en-us/library/bb490943.aspx); replace "Ethernet" with the name of the card you want to configzure, and obviously with your gateway address:
netsh.exe interface ip set address name="Ethernet" gateway=

Open in new window

Steve KnightIT ConsultancyCommented:
Or for temporary changes I would normally change the routing table and keep your gateway the same:

route delete
route add mask X.X.X.X

Use this to see the results:

route print

That will need to be run as admin, e.g. a quick batch file:

@echo off
route print | find ""
Set Gateway=
set /p Gateway=Enter new gateway - press return for %gateway%:
route delete
route add mask %gateway%

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now