XP: Set or configure network interface to DHCP wtih netsh from command line

Contributor Icon Contributed by qmchenry Date Icon July 18, 2006  
Tag Icon Tagged: Windows networking

My predisposition to command line solutions to problems stems from my UNIXness and, well, I’ll admit that it’s fun to intimidate GUI users. However, there are times that command line solutions are the best fit for a problem. For example, if you find yourself frequently switching between a static IP address and DHCP for a network interface as happens with laptops sometimes, wouldn’t it be nice to have a command that could fit in a batch file? The netsh command in XP SP2 makes this possible. This recipe shows the command to make an interface use DHCP.


To make the interface Local Area Network use DHCP instead of a static address, use the command (all on one line):

netsh int ip set address name="Local Area Connection" source=dhcp

Other interface names can be substituted as needed.

Previous recipe | Next recipe |
 
  • Name
    What if I would like to have DHCP and static ip at the same time (multiple ip on one NIC). Now I have to use Regedit. BR
blog comments powered by Disqus