Windows Batch network adapter settings

Source: Internet
Author: User
Tags dns2

Fixed IP and DNS settings

1@echo OFF//do not display subsequent command lines and the current command line2  3Set Netname="The name of the network to be modified"4Set ip=XXX.XXX.XXX.XXX5Set subnetmask=XXX.XXX.XXX.XXX6Set gateway=XXX.XXX.XXX.XXX7Set dns1=XXX.XXX.XXX.XXX8Set dns2=XXX.XXX.XXX.XXX9  Ten@netsh interface IP set address name=%netname% source=static addr=%ip% mask=%subnetmask% gateway=%gateway% gwmetric=1 //Default Gateway Metric One@netsh interface IP set DNS name=%netname% source=static addr=%dns1% Primary//of the main A@netsh interface IP Add DNS name=%netname% addr=%dns2% index=2 //for the specified DNS server address

Auto Get (IP and DNS)

1 @echo OFF 2  3 Set netname=" Ethernet "4  5 @netsh interface IP set address name=%netname% source=DHCP6 @netsh interface ip set DNS name=%netname% SOURCE=DHCP

Windows Batch network adapter settings

Related Article

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.