The other day, I wrote a post on Setting Your IP Address Via Batch File. In this post, I’ll teach you how to reset your IP information from a different batch file.

This command will work in both Windows XP and Windows Vista

Why Would I Use This?

Lets say you transport your laptop to and from work. At work you use a static IP and at home you use DHCP. This batch file will automatically change your network settings to DHCP.

How To

Create a net text file, copy/paste this code and save the new text file with a .bat extension!

The Code

  1. @ECHO OFF
  2. ECHO This fanciness is brought to you by Saman Sadeghi!
  3.  
  4. ECHO Resetting IP Address and Subnet Mask For DHCP
  5. netsh int ip set address name = "Local Area Connection" source = dhcp
  6.  
  7. ECHO Resetting DNS For DHCP
  8. netsh int ip set dns name = "Local Area Connection" source = dhcp
  9.  
  10. ECHO Resetting Windows Internet Name Service (WINS) For DHCP
  11. netsh int ip set wins name = "Local Area Connection" source = dhcp
  12.  
  13. ECHO Here are the new settings for %computername%:
  14. netsh int ip show config
  15.  
  16. pause

Download

You can download the raw code for this batch file, just make sure that you save it with a .bat extension!