您好,登錄后才能下訂單哦!
本篇內容主要講解“用批處理腳本實現ip地址切換”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“用批處理腳本實現ip地址切換”吧!
代碼如下:
@echo off
rem # ----------------------------------
rem # 接口 IP 配置
rem # ----------------------------------
echo "=========IP 控制管理=========="
echo "=> d: 自動獲取IP"
echo "=> h: 寢室 IP地址:66.168.1.8"
echo "=> r: 公司網絡 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%\>">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
:: "公司網絡"
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 配置結束
到此,相信大家對“用批處理腳本實現ip地址切換”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。