Windows Batch Settings IP address

Source: Internet
Author: User
Tags dns2 get ip

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.