本篇內(nèi)容主要講解“用批處理腳本實現(xiàn)ip地址切換”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“用批處理腳本實現(xiàn)ip地址切換”吧!
創(chuàng)新互聯(lián)憑借在網(wǎng)站建設(shè)、網(wǎng)站推廣領(lǐng)域領(lǐng)先的技術(shù)能力和多年的行業(yè)經(jīng)驗,為客戶提供超值的營銷型網(wǎng)站建設(shè)服務(wù),我們始終認為:好的營銷型網(wǎng)站就是好的業(yè)務(wù)員。我們已成功為企業(yè)單位、個人等客戶提供了成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)服務(wù),以良好的商業(yè)信譽,完善的服務(wù)及深厚的技術(shù)力量處于同行領(lǐng)先地位。代碼如下:
@echo off
rem # ----------------------------------
rem # 接口 IP 配置
rem # ----------------------------------
echo "=========IP 控制管理=========="
echo "=> d: 自動獲取IP"
echo "=> h: 寢室 IP地址:66.168.1.8"
echo "=> r: 公司網(wǎng)絡(luò) IP地址:192.168.250.173"
echo "請輸入對應(yīng)的序號d,h,r,按回車鍵結(jié)束: "
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
:: "寢室"
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)絡(luò)"
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 配置結(jié)束
到此,相信大家對“用批處理腳本實現(xiàn)ip地址切換”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)建站,更多相關(guān)內(nèi)容可以進入相關(guān)頻道進行查詢,關(guān)注我們,繼續(xù)學習!