Most of the time user use same laptop at home as well as at office. At home most probebly they have different network and in office if the system administrator is smart, he will be using DHCP server to allocate IP address. While working from home they have to set IP address manually as per their ISP. To make this task easier we can use netsh.

Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh also provides a scripting feature that allows you to run a group of commands in batch mode against a specified computer. Netsh can also save a configuration script in a text file for archival purposes or to help you configure other servers.


netsh [-a AliasFile] [-c Context] [-r RemoteComputer] [{NetshCommand|-f ScriptFile}]

To export current configuration, run following command. It will dump all the current connection setting to office.txt file in c drive

netsh -c interface dump > c:\home.txt

To import configuration, run following command.

netsh -f c:\home.txt

To configure your NIC to automatically obtain an IP address and DNS from a DHCP server

netsh interface ip set address "Local Area Connection" dhcp
netsh interface ip set dns "Local Area Connection" dhcp

Local Area Connection is my connection name. To see what connection you have, go to run, type ncpa.cpl and press enter.

To configure your NIC with the static IP address, the subnet mask of, and a default gateway of

netsh interface ip set address "Local Area Connection" static 1
netsh interface ip set dns "Local Area Connection" static

Configure TCP/IP from the Command Prompt using Netsh

Leave a Reply

Your email address will not be published. Required fields are marked *