復制代碼 代碼如下:
@echo off
rem # ----------------------------------
rem # 接口 IP 配置
rem # ----------------------------------
echo "=========IP 控制管理=========="
echo "=> d: 自動獲取IP"
echo "=> h: 寢室 IP地址:66.168.1.8"
echo "=> r: 公司網(wǎng)絡 IP地址:192.168.250.173"
echo "請輸入對應的序號d,h,r,按回車鍵結束: "
set /p ch=
if %ch%=="" echo "You input null"goto :EOF
set case=d,h,t,w>nul
echo %case%|findstr "\%ch%\&;">nulif errorlevel 1 goto :err
goto %ch%
goto err
:h
:: "寢室"
echo "configure home ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連接" static 66.168.1.8 255.255.255.0 66.168.1.1 1 >nul
@netsh int ip set dns "本地連接" static 66.168.1.1 PRIMARY >nul
echo home ip configure is done
goto :EOF
:r
:: "公司網(wǎng)絡"
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連接" static 192.168.250.173 255.255.255.0 192.168.250.1 1 >nul
echo transport ip configure is done
goto :EOF
:d
:DHCP "自動獲取IP地址"
echo "configure transport ip address gateway,please wait 30 second ..."
@netsh int ip set address "本地連接" dhcp >nul
@netsh int ip set dns "本地連接" dhcp >nul
:err
:: "error"
echo your input "%ch%" ,no this argument ! please input h or w! game over
rem # 接口 IP 配置結束
您可能感興趣的文章:- BAT 批處理腳本教程(詳細篇腳本之家補充)
- Windows server利用批處理腳本判斷端口啟動tomcat的方法
- Windows下編寫批處理腳本來啟動和重置Oracle數(shù)據(jù)庫
- Windows下bat批處理腳本使用telnet批量檢測遠程端口小記
- 實現(xiàn)android應用程序自動化測試的批處理腳本
- 批量安裝windows補丁的批處理腳本
- QQ多帳號自動登錄批處理腳本
- 本地連接禁用/啟用批處理腳本
- DOS批處理腳本語言簡介與詳細說明
- Windows注冊表中修改UAC(用戶賬號控制)及批處理腳本