Quickly change IP configuration with netsh

If the computer on a network is not configured to receive IP addresses dynamically from a DHCP server, the IP address has to be changed manually. A netsh configuration file can help change the IP address with minimum manual intervention. Netsh allows users to change the TCP/IP parameters from the command line. With the change in the environmental settings in the computer, netsh can configure the files to change the TCP/IP settings of the new environment automatically. This can reduce the time and effort spent inputting the entire network configuration of the computer. Changing the IP address configuration with netsh is quick and easy.

Sometimes it happens that your status is not systematically set as DHCP client, depending on the environment in which it operates. It becomes cumbersome to constantly change the TCP/IP parameters. Consider a simple example:

  • Environment 1: Office. The parameters are:

IP Address: / 16




  • Environment 2: Main Client at which it moves 2 to 3 times per week.

IP Address: / 24



  • Environment 3: Home: DHCP client

We can note that changing environment is not an easy task. Fortunately, there is a feature of Windows that will simplify our task.
As you already know, netsh allows you to change most TCP/IP parameters via the command line.
So we will simply configure the environments that are mostly used.

  • Start with the "office" environment in the example above. We will of course enter the settings, step by step. When the NIC is configured, open a command prompt and simply type:
netsh -c interface dump >office.txt 

This is the first step: you just created a netsh configuration file.

For the client configuration, the procedure is the same:

  • Configure the network card with the correct parameters
  • Open a command prompt
netsh -c interface dump >client.txt 

And finally, the home setup:

  • Configure the DHCP client card
  • Open a command prompt
taper netsh -c interface dump >home.txt

How to move from one configuration to another? Just call the corresponding configuration file:


  • Open a command prompt
  • Type
    netsh -f office.txt


  • Open a command prompt
  • Type
    netsh -f client.txt


  • Open a command prompt
  • Type
    netsh -f home.txt

The benefits:

  • No need to input tedious when changing environment
  • If an environment changes, it directly modifies the corresponding txt file.
Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Quickly change IP configuration with netsh », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).