The BAT option modifies the IP script code (allowing the user to select the operation and perform the judgment) _dos/bat

Source: Internet
Author: User
The effect is shown in the following illustration:




The code is as follows:

Copy Code code as follows:

@Echo off
TITLE Cloud-dwelling community IP device

: Start
Cls
COLOR 2f
:: Change the console output color using the color command
Mode con cols=56 lines=20
:: Mode statement to set the width and height of the form
: Sc_main
Echo-------------------------------------------
Echo.&echo.
echo 0.192.168.0.99 & Echo.
echo 1.192.168.1.99 & Echo.
echo Q. Exit & Echo.&echo.&echo.&echo.&echo.&echo.

Set "select="
set/p select= Enter a number, press ENTER to continue:
If "%select%" = = "0" (Goto sc_ip0)
If "%select%" = = "1" (Goto SC_IP1)
If "%select%" = = "Q" (Goto sc_exit)

: Sc_exit
Exit
Goto:eof

: Sc_ip0
Cls
Echo is setting, please wait
Netsh interface IP Set Address "Local Area Connection" Static 192.168.0.99 255.255.255.0 192.168.0.1 1
Netsh interface IP Set DNS "Local Area Connection" static 192.168.0.1 Primary
Echo Set Successful 192.168.0.99
PAUSE >nul
Goto Sc_main
: Sc_ip1
Cls
Echo is setting, please wait
Netsh interface IP Set Address "Local Area Connection" Static 192.168.1.99 255.255.255.0 192.168.1.1 1
Netsh interface IP Set DNS "Local Area Connection" static 192.168.1.1 Primary
Echo Set Successful 192.168.1.99
PAUSE >nul
Goto Sc_main

The function of setting IP inside is implemented through the Netsh command line. The specific usage can be viewed in cmd.


Netsh interface IP Set Address "Local Area Connection" Static 192.168.1.99 255.255.255.0 192.168.1.1 1
Netsh interface IP Set DNS "Local Area Connection" static 192.168.1.1 Primary

The first line is the IP subnet mask gateway that sets IP
The second line is set DNS IP, if you know that the DNS IP network can not set this, the first line on it.

In general, DNS is set to gateway IP.

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.