Computers often run back and forth between lab rooms and dormitories, with fixed IPs in lab rooms, Dormitory use is dr.com client, need to use dynamic IP, change to good trouble said, for me such a lazy person, of course, to seek a shortcut, batch processing is a good choice, the following is attached to the batch code:
The first is to set the static IP address
off title static IP settings set name= Local Connection (the name of the connection)set ip=xxx.xxx. xxx.xxx (IP address to set)
Setmask=255.255.255.0 (subnet mask)Setgw=xxx.xxx.xxx.xxx (Gateway)Setdns=xxx.xxx.xxx.xxx (DNS)SetDns2=xxx.xxx.xxx.xxx (Alternate DNS)NetshintIpSetAddr Name="%name%"Source=Staticaddr=%ip% mask=%mask% gateway=%gw% gwmetric=1NetshintIpSetDNS Name="%name%"Source=Staticaddr=%dns% register=PrimarynetshintIP Add DNS name="%name%"Addr=%dns2%netshInterfaceIpSetWINS Name="%name%"Source=StaticAddr=noneecho static IP settings complete Pause
Use the time to change XXXX to its own address, the contents of the parentheses delete can be
Dynamic IP address settings (all addresses are set to get automatically)
off title Dynamic Auto Get IP settings set name=intset addr name="%name%" intset DNS name="%name%" Dhcpecho dynamically automatically get IP settings complete pause
Save all your code as *.bat and double-click to use it, but you need to make security software like 360 to trust it. Otherwise pop-up window//
Windows Batch Settings IP address