Batch manually set the computer's IP

Source: Internet
Author: User
Tags blank page

Reference:

http://blog.csdn.net/jiangzhanchang/article/details/7063152

http://wenda.haosou.com/q/1378697364060589

Http://blog.sina.com.cn/s/blog_62defbef0101ow9y.html

First, prepare the editor

1, open notepad++;

2, create a blank page;

3, because the encoding method in CMD is ANSI, so set to ANSI encoding

Second, enter the code

@echo off: Turn off EchoEcho----automatically get the IP address batch file from the Garfieldjiang column---Echo-----http://Hi.csdn.net/jiangzhanchang------------------Echo-----changed by Tingpan---------------------------------Echosetting IP address manually, please wait ... netsh interface ipv4 set address"Local Connection"Static172.16.1.165 255.255.255.0 172.16.1.1: The above line addresses are: IP address, subnet mask, default gateway netsh interface ipv4 add address"Local Connection" 192.168.0.165netsh interface ipv4 add address"Local Connection" 192.168.1.165netsh interface ipv4 set dnsservers"Local Connection"Static114.114.114.114Primary: The above row sets the primary DNS server address for the netsh interface IPv4 set dnsservers"Local Connection"Static172.16.1.1: The above line sets the secondary DNS server address: "Local Area Connection" in the above lines of code can be modified to other as needed, such as "Wireless network Connection"if%errorlevel%==0(netsh interface ipv4 show ip)Else(Echo---------------------error has occurred! -----------------&EchoError code:%errorlevel%&EchoRight-click to select "Run with Administrator" &Echo---------------------------------------------------): &represents a line break pause

Third, files saved in bat format

Batch manually set the computer's IP

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.