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.