Home » Tips and Tutorials, Windows

Windows – Change the IP address from the command line with Netshell

Submitted by on Friday, 13 January 2012No Comment

Under Windows 2000/Windows XP and above, it is possible to change the TCP / IP from a single command line, for example to automate this task with a script.

This is possible thanks to the tool netsh.exe (NetShell), whose parameters are specified below.

Setting the IP address

 

For setting a static IP address

  netsh interface ip set address "Description" static address%%%%% netmask gateway metric%%%
  • Description refers to a text describing the connection name
  • %% Address means the IP address
  • %% Netmask is the subnet mask
  • %% Gateway is the IP address of the gateway
  • %% Metric is the metric of the network card (in general = 1)

For example:

  netsh interface ip set address "LAN" static 192.168.0.3 255.255.255.0 192.168.0.1 1

 

For setting up a dynamic IP address (DHCP)

  netsh interface ip set address "Description" dhcp

 

Setting the name server (DNS)

  netsh interface ip set dns "Description" static DNS%%
  • %% Means the DNS server IP address DNS

Related Posts:

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.

Notify me of followup comments via e-mail. You can also subscribe without commenting.