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
-
@ECHO OFF
-
ECHO This fanciness is brought to you by Saman Sadeghi!
-
-
ECHO Resetting IP Address and Subnet Mask For DHCP
-
netsh int ip set address name = "Local Area Connection" source = dhcp
-
-
ECHO Resetting DNS For DHCP
-
netsh int ip set dns name = "Local Area Connection" source = dhcp
-
-
ECHO Resetting Windows Internet Name Service (WINS) For DHCP
-
netsh int ip set wins name = "Local Area Connection" source = dhcp
-
-
ECHO Here are the new settings for %computername%:
-
netsh int ip show config
-
-
pause
Download
You can download the raw code for this batch file, just make sure that you save it with a .bat extension!
No to only figure out how to get Vista aware of the network shares on my workgroup. I hate cheap wireless routers!
You are having issues? It seams like Vista’s new network utility would make that easy. But you mentioned that it’s your wireless router…
can u provide me the batch code for automatic repairing the Local area network connection in windows xp sp2 after every 5 sec or continuously.
while repairing manually this following processes takes place;
* Dynamic Host Configuration Protocol (DHCP) lease is renewed: ipconfig /renew
* Address Resolution Protocol (ARP) cache is flushed: arp -d *
* Reload of the NetBIOS name cache: nbtstat -R
* NetBIOS name update is sent: nbtstat -RR
* Domain Name System (DNS) cache is flushed: ipconfig /flushdns
* DNS name registration: ipconfig /registerdns
can u help me regarding the same.
Please do email me if u can.
any help wud be appreciated. its very urgently required on my network
I didn’t know you could do this before. Thanks for the informative post.
You’re welcome! There is a tone of useful things that you can do with them!! Check out some more of the tutorials that I’ve made.
Great helpful post.
This batchfile works well,but is there a way one caninclude a proxy & port number as at teh offiec users work from various branches which have their own firewall.
Many tx
Selwyn
Hide Your Ip is better than changing it ,
Hi
When I run the batch file on a Vists ultimate system I get an error messager
“The requested operation requires elevation” this is repeated twice.
I have tried to change the bat file admin privaledges but this option is greyed out.
Any ideas
Thanks
I copied the .bat file to another user’s Desktop and he could not run the patch. Actually the message said “access denied”: it was a regular user, not the administrator. I tried to right-click and select “run as” option, but it wasn’t there!
should we make an .exe file? If so, how to make it? Is it possible to make the computer understand that ip change is authrised at that time? how to add that authorization/authentication into the patch?
Am I asking too many quastions
will be glad to hear from you soon
thank you
bayram
If your friend’s account is set as a Limited User, then you need to contact your friend’s computer’s administrator, there may be a reason they don’t want you to change the IP.
I run the two batch program it works fine but it change only my LAN adapter settings but for my wireless adapter settings nothing changed. it would be better if it works both LAN adapter and wireless adapter because some people nowadays uses laptop and we all knew that laptop used wireless connection.
VERY NICE!
Hi All,
When run the batch script, I get the error “Element not found” when running the netsh statement in the batch file.
Please advise.
Thanks in advance
Krish
Thanks a lot, wonderful tool, gr8 usage.