IP Address switching batch script sharing _dos/bat

Source: Internet
Author: User
Tags get ip goto

Copy Code code as follows:

@echo off
REM #----------------------------------
REM # interface IP configuration
REM #----------------------------------

echo "=========ip control management =========="
echo "=> D: Automatically get IP"
echo "=> H: Bedroom IP address: 66.168.1.8"
echo "=> r: Corporate network IP address: 192.168.250.173"
echo "Please enter the corresponding ordinal d,h,r and press ENTER to end:"
set/p ch=
If%ch%== "" echo "You input null" &goto:eof
Set Case=d,h,t,w>nul
echo%case%|findstr "\<%ch%\>" >nul&if errorlevel 1 Goto:err
Goto%ch%
Goto ERR

: H
:: "Bedroom"
echo "Configure home IP address gateway,please wait second ..."
@netsh int IP set Address "Local Area Connection" static 66.168.1.8 255.255.255.0 66.168.1.1 1 >nul
@netsh int IP set DNS "Local Area Connection" Static 66.168.1.1 PRIMARY >nul
Echo Home IP Configure is done
Goto:eof

: R
:: "Company Network"
echo "Configure transport IP address gateway,please second ..."
@netsh int IP set Address "Local Area Connection" static 192.168.250.173 255.255.255.0 192.168.250.1 1 >nul
Echo Transport IP Configure is done
Goto:eof

:d
:D HCP "Automatically obtain IP address"
echo "Configure transport IP address gateway,please second ..."
@netsh int IP set Address "Local Area Connection" DHCP >nul
@netsh int IP set DNS "Local Area Connection" DHCP >nul

: Err
:: "Error"
echo your input "%ch%", no this argument!  Please input H or w! Game Over
REM # interface IP configuration End

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.