Automatically modify the computer ip address. bat

Source: Internet
Author: User

 

@ Echo.
@ Echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※
@ Echo ※※
@ Echo ※this command is used to automatically set the IP addresses of wireless networks and local connections ※
@ Echo ※※
@ Echo ※※
@ Echo ※ 1 -Set the wireless network address to 192. 168.1 . 123 Used for company Internet access ※
@ Echo ※※
@ Echo ※ 2 -Set the wireless network address to be automatically obtained for external internet access ※
@ Echo ※※
@ Echo ※ 3 -Set the local connection address to 192. 168.2 . 23 Used for concentrator connection ※
@ Echo ※※
@ Echo ※ 4 -Set the local connection address to be automatically obtained for external access ※
@ Echo ※※
@ Echo ※※※※※※※※※※※※※※※※※※※※※※※※※※※※
@ Echo.
@ Echo.
@ Echo.
@ Echo ***** select the setting method [ 1 , 2 , 3 , 4 ], And press enter to confirm the execution ******
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Set/p st = " Method Selection: "
Echo.
If /I " % St % " = " 1 " Goto Setip1
If /I " % St % " = " 2 " Goto Setip1no
If /I " % St % " = " 3 " Goto Setip2
If /I " % St % " = " 4 " Goto Setip2no
: Setip1
CLS
@ Echo.
@ Echo ---------------------------------------------
@ Echo this command will automatically fill in the following content for "wireless network connection:
@ Echo IP Address: 192.168 . 1.123
@ Echo subnet mask: 255.255 . 255.0
@ Echo Gateway: 192.168 . 1.1
@ Echo.
@ Echo preferred DNS: 61.144 . 56.100
@ Echo backup DNS: 61.144 . 56.101
@ Echo ---------------------------------------------
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Pause
@ ECHO: Set the IP address...
@ Echo off
Netsh Interface IP Set Address name = " Wireless Network Connection " Source = Static ADDR = 192.168 . 1.123 Mask = 255.255 . 255.0 Gateway = 192.168 . 1.1 1
@ ECHO: Set DNS first...
@ Echo off
Netsh Interface IP Set DNS name = " Wireless Network Connection " Source = Static ADDR = 61.144 . 56.100
@ ECHO: Set backup DNS...
@ Echo off
Netsh Interface IP add DNS " Wireless Network Connection " 61.144 . 56.101 Index = 2
@ ECHO: the setting is complete.
@ Pause
Exit
: Setip1no
CLS
@ Echo.
@ Echo ----------------------------------------
@ Echo this command will automatically fill in the following content for "Local Connection:
@ Echo.
@ ECHO: automatically obtains the IP address
@ Echo automatically obtains the DNS server address
@ Echo -----------------------------------------
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Pause
@ Echo.
@ Echo off
@ ECHO: set to automatically obtain the IP address...
Netsh Interface IP Set Address name = " Wireless Network Connection " Source = DHCP
@ Echo sets to automatically retrieve the DNS server address...
Netsh Interface IP Set DNS name = " Wireless Network Connection " Source = DHCP
@ Echo.
@ ECHO: the setting is complete.
@ Pause
Exit
: Setip2
CLS
@ Echo.
@ Echo ---------------------------------------------
@ Echo this command will automatically fill in the following content for "Local Connection:
@ Echo IP Address: 192.168 . 2.23
@ Echo subnet mask: 255.255 . 255.0
@ Echo ---------------------------------------------
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Pause
@ Echo.
@ Echo off
@ ECHO: Set the IP address...
Netsh Interface IP Set Address name = " Local Connection " Source = Static ADDR = 192.168 . 2.23 Mask = 255.255 . 255.0
@ Echo sets to automatically retrieve the DNS server address...
Netsh Interface IP Set DNS name = " Local Connection " Source = DHCP
@ ECHO: the setting is complete.
@ Echo.
@ Pause
Exit
: Setip2no
CLS
@ Echo.
@ Echo ----------------------------------------
@ Echo this command will automatically fill in the following content for "Local Connection:
@ Echo.
@ ECHO: automatically obtains the IP address
@ Echo automatically obtains the DNS server address
@ Echo -----------------------------------------
@ Echo.
@ Echo.
@ Echo.
@ Echo.
@ Pause
@ Echo.
@ Echo off
@ ECHO: set to automatically obtain the IP address...
Netsh Interface IP Set Address name = " Local Connection " Source = DHCP
@ Echo sets to automatically retrieve the DNS server address...
Netsh Interface IP Set DNS name = " Local Connection " Source = DHCP
@ Echo.
@ ECHO: the setting is complete.
@ Pause
Exit

From: http://blog.csdn.net/fljxzxb/article/details/6885699

Personal favorites

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.