Using a. bat batch file to switch multiple IP addresses over and outside the network

Source: Internet
Author: User
Tags goto
The code is as follows Copy Code

:: Using the. bat batch file to implement the switching of multiple IP addresses in the Intranet demo file: Ipchange.bat
:: Can also add more than 3,4,5 IP address, as long as the corresponding if statement and label jump tag can be
:: Preferred DNS for Google's 8.8.8.8, alternate DNS for 8.8.4.4
@Echo off
TITLE IP Settings
: Start
Cls
Color 3f
:: 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.154.29 & Echo.
echo 1.132.114.154.29 & 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.154.29 255.255.255.0 192.168.154.250 1
netsh interface ip set DNS "Local Area Connection" static 8.8.8.8
netsh interface ip add DNS "Local Area Connection" 8.8.4.4
Echo successfully set up extranet 192.168.154.29
PAUSE >nul
Goto Sc_main
: Sc_ip1
Cls
Echo is setting, please wait
netsh interface IP Set address "Local Area Connection" Static 132.114.154.29 255.255.255.0 132.114.154.250 1
netsh interface ip set DNS "Local Area Connection" static 8.8.8.8
netsh interface ip add DNS "Local Area Connection" 8.8.4.4
Echo successfully set up intranet 132.114.154.29
PAUSE >nul
Goto Sc_main

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.