Changing IP address via command line on Windows XP

后端 未结 2 1021
南笙
南笙 2020-12-30 08:27

I\'m trying to change a machine IP address via cmd.exe with this code:

netsh int ip set address name=\"Local Area Connection\" source=static addr=???.???.??         


        
相关标签:
2条回答
  • 2020-12-30 08:50

    You can use the command below:

    netsh interface ip set address name="Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1
    

    where

    • the 192.168.0.100 is the IP address
    • the netmask is 255.255.255.0
    • and the gateway is 192.168.0.1

    You can also have the DNS configured automatically by DHCP using following command:

    netsh interface ip set dns "Local Area Connection" dhcp
    
    0 讨论(0)
  • If you are looking for change it regularly here is a trick :)

    netsh interface ip set address name="Wi-Fi" static 192.168.1.140 255.255.255.0 192.168.1.1 // this change IP
    netsh interface ip add dns name="Wi-Fi" 8.8.8.8 index=2 //this change DNS
    pause
    

    type above in notepad and save as ip.bat.
    run the file as administrator

    0 讨论(0)
提交回复
热议问题