BAT腳本實(shí)現(xiàn)自動(dòng)IP地址切換?
發(fā)布日期:2022-07-15 19:18 | 文章來(lái)源:源碼中國(guó)
BAT自動(dòng)IP地址切換腳本如下:
@echo off color 3f mode con cols=80 lines=30 title 自動(dòng)IP地址切換腳本 By 小強(qiáng) if "%1"=="1" goto office if "%1"=="2" goto Home if "%1"=="3" goto dhcp :start cls echo= echo ============================================================================ echo= echo 1.切換到辦公室IP echo= echo 2.切換到家里的IP echo= echo 3.切換到自動(dòng)獲取 echo= echo 0.退·出·腳·本 echo= echo ============================================================================ echo= set choice= set /p choice=請(qǐng)輸入你的選擇: if "%choice%"=="1" goto office if "%choice%"=="2" goto Home if "%choice%"=="3" goto dhcp if "%choice%"=="0" exit echo 輸入有誤,請(qǐng)重新選擇! pause>nul goto start :office cls cls echo. echo 正在設(shè)置IP為辦公I(xiàn)P請(qǐng)等待... echo. set net_interface="本地連接" echo 設(shè)置IP中... netsh interface ip set address "%net_interface%" source=static addr=192.168.0.5 mask=255.255.255.0 echo 設(shè)置IP成功...設(shè)置網(wǎng)關(guān)中... netsh interface ip set address name="%net_interface%" gateway=192.168.0.1 gwmetric=1 echo 設(shè)置網(wǎng)關(guān)成功...設(shè)置DNS中... netsh interface ip set dns "%net_interface%" static 202.98.0.68 netsh interface ip add dns "%net_interface%" 202.98.5.68 index=2 echo IP已成功切換到辦公設(shè)置,任意鍵返回... pause>nul goto start :home cls echo. echo 正在設(shè)置為家用IP請(qǐng)等待... echo. set net_interface="本地連接" echo 設(shè)置IP中... netsh interface ip set address "%net_interface%" source=static addr=192.168.1.111 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 218.85.152.99 netsh interface ip add dns "%net_interface%" 218.85.157.99 index=2 echo IP已成功切換到辦公設(shè)置,任意鍵返回... pause>nul goto start :DHCP echo. echo 正在設(shè)置IP為自動(dòng)獲取,請(qǐng)等待... echo. set net_interface="本地連接" 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 echo 設(shè)置成功!按任意鍵返回選擇菜單。 pause>nul GOTO start
到此這篇關(guān)于BAT腳本實(shí)現(xiàn)自動(dòng)IP地址切換 的文章就介紹到這了,更多相關(guān)BAT IP地址切換 內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
相關(guān)文章