mode con cols=55 lines=15
rem 設(shè)置公用變量
set net_interface="本地連接"
:CHOICE
color a
cls
echo *****************IP快速切換程序***********************
echo ----【IP設(shè)置功能】---------------【系統(tǒng)功能】-----
echo -----1.修改為HomeIP-------------------------------
echo -----2.修改為OfficeIP-------------r.重啟網(wǎng)卡------
echo -----3.修改為自動(dòng)獲取-------------X.退出程序------
echo.
echo 本程序僅對(duì)名稱為"%net_interface%"的網(wǎng)卡進(jìn)行設(shè)置-----
echo ******************************Tools By Li.Zero********
echo.
echo.
:mu
set /p choice= 請(qǐng)輸入您的選擇:
IF NOT "%choice%"=="" SET choice=%choice:~0,1%
if /i "%choice%"=="1" goto home_ip
if /i "%choice%"=="2" goto office_ip
if /i "%choice%"=="3" goto DHCP
if /i "%choice%"=="r" goto reboot
if /i "%choice%"=="X" goto END
echo.
echo.
echo 輸入的選擇不正確,請(qǐng)重新輸入!
echo.
echo.
GOTO CHOICE
pause
:home_ip
cls
echo.
echo 正在設(shè)置IP為home_ip,請(qǐng)等待...
echo.
echo 設(shè)置IP中...
netsh interface ip set address "%net_interface%" source=static addr=192.168.1.141 mask=255.255.255.0
echo 設(shè)置IP成功...設(shè)置網(wǎng)關(guān)中...
netsh interface ip set address name="%net_interface%" gateway=192.168.1.1 gwmetric=1
echo 設(shè)置網(wǎng)關(guān)成功...設(shè)置DNS中...
netsh interface ip set dns "%net_interface%" static 202.100.192.68
netsh interface ip add dns "%net_interface%" 202.100.199.8 index=2
echo 設(shè)置完成。
pause | echo 按任意鍵返回選擇菜單。
GOTO CHOICE
:office_ip
cls
echo.
echo 正在設(shè)置IP為office_ip,請(qǐng)等待...
echo.
echo 設(shè)置IP中...
netsh interface ip set address "%net_interface%" source=static addr=192.168.253.141 mask=255.255.255.0
echo 設(shè)置IP成功...設(shè)置網(wǎng)關(guān)中...
netsh interface ip set address name="%net_interface%" gateway=192.168.253.1 gwmetric=1
echo 設(shè)置網(wǎng)關(guān)成功...設(shè)置DNS中...
netsh interface ip set dns "%net_interface%" static 202.100.192.68
netsh interface ip add dns "%net_interface%" 202.100.199.8 index=2
pause |echo 任務(wù)完成,按任意鍵返回選擇菜單。
GOTO CHOICE
:DHCP
echo.
echo 正在設(shè)置IP為自動(dòng)獲取,請(qǐng)等待...
echo.
echo 設(shè)置IP中...
netsh interface ip set address name="%net_interface%" source=dhcp
echo 設(shè)置網(wǎng)關(guān)成功...設(shè)置DNS中...
netsh interface ip set dns "%net_interface%" source=dhcp
pause |echo 任務(wù)完成,按任意鍵返回選擇菜單。
GOTO CHOICE
:reboot
echo 重啟網(wǎng)卡中...請(qǐng)稍等...
netsh interface set interface "%net_interface%" disabled
netsh interface set interface "%net_interface%" enable
pause |echo 任務(wù)完成,按任意鍵返回選擇菜單。
GOTO CHOICE
:end
exit