Win automatically fill in the IP address script

Source: Internet
Author: User
Tags dns2

@ Echo off
02
Rem setting Variables
03
Set Nic = wireless network connection
04
Rem // www.2cto.com can be changed as needed,
05
Set Addr = 192.168.20.6
06
Set Mask = 255.255.255.0
07
Set Gway = 192.168.2.1
08
Set Dns1 = 202.102.152.3
09
Set Dns2 = 202.102.154.3
10
Rem // ip address, subnet mask, gateway, preferred DNS, and backup DNS
11
Echo ------------------------------------------------------
12
Echo is configuring IPaddress. Please wait.
13
Rem // can be changed as needed
14
Echo. IP address = % Addr %
15
Echo. subnet Mask = % Mask %
16
Netsh interface ip set address name = % Nic % source = static addr = % Addr % mask = % Mask %> nul
17
Echo. Gateway = % Gway %
18
Netsh interface ip set address name = % Nic % gateway = % Gway % gwmetric = 1> nul
19
Echo. preferred DNS = % Dns1 %
20
Netsh interface ip set dns name = % Nic % source = static addr = % Dns1 % register = PRIMARY> nul
21
Echo. Alternate DNS = % Dns2 %
22
Netsh interface ip add dns name = % Nic % addr = % Dns2 % index = 2> nul
23
Echo ------------------------------------------------------
24
Echo ipsettings complete!
25
Netsh interface ip add dns name = % Nic % addr = % Dns3 % index = 2> nul
26
Rem pause> nul

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.