How to Change the IP address using a batch file
If you're new here, you may want to subscribe to Windows Reference RSS feed Thanks for visiting!
If you want to change the ip address of your system using the batch file use the following scripts
This code should work in XP,Vista and 2003. Vista users have to run the batch file as an administrator.
(Right click the batch file and click “Run as Administrator”)
For Static IP address
Open notepad and enter the following code now you need to save this file as static.bat after saving this file you need to double click on static.bat file to run
Note:- Change the values according to your settings in the following script
:: Enter your static ip address, Subnet Mask and Default Gateway
netsh interface ip set address name = “Local Area Network Connection” source = static addr = 192.168.0.12 mask = 255.255.255.0 gateway = 192.168.0.2 gwmetric = 1
:: Enter your Preferred DNS Server
netsh interface ip set dns name=”Local Area Network Connection” static 24.92.22.90
:: Enter your Alternate DNS Server, if you dont know remove the following line
netsh interface ip add dns name=”Local Area Network Connection” 24.92.22.102 index=2
For DHCP
Open notepad and enter the following code now you need to save this file as dhcp.bat after saving this file you need to double click on dhcp.bat file to run
netsh interface ip set address name=”Local Area Network Connection” source=dhcp
netsh interface ip set dns name=”Local Area Network Connection” source=dhcp register=primary
netsh interface ip set wins name=”Local Area Network Connection” source=dhcp
Random Posts
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically each day to your feed reader.
Trackbacks & Pingbacks
Comments
Leave a comment
Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>






Very helpful – thanks.
Thanks this is a life saver!
“For Static IP address”
“For DHCP”
I do not use DHCP. What about dynamic IP address??
thanks dear, but from where can I download that batch file
Not what I was looking for, but teached me a thing and is very usefull at my temporary location. THX !