Mar 162008
 


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

Incoming search terms:

  12 Responses to “How to Change the IP address using a batch file”

  1. Very helpful – thanks.

  2. Thanks this is a life saver!

  3. “For Static IP address”
    “For DHCP”

    I do not use DHCP. What about dynamic IP address??

  4. thanks dear, but from where can I download that batch file

  5. Not what I was looking for, but teached me a thing and is very usefull at my temporary location. THX !

  6. do you know a batch command to add a random ip to local area connection speciified in a parameter of 100 to 223
    and then I need to a dhcp command following and a ipconfig/release command before the random ip

  7. do you know also how to make a batch file loop a specified number of times

  8. change ip dynamic ip batch file downlod link

  9. this is not working for windows 7.

  10. Excellent script. I had to manually retype all the inverted commas / speech marks as for some reason they didn’t copy over properly. I also had to change the name from “Local Area Network Connection” to “Local Area Connection” as that is what it was called on my computer

  11. super!!! thankz!! :D

  12. i cant understand the code.please some one tell me the code for static,i want to copy the code

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>