西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
軟件
軟件
文章
搜索

首頁編程開發(fā)其它知識(shí) → 一個(gè)快速修改本地IP地址的命令行bat文件

一個(gè)快速修改本地IP地址的命令行bat文件

相關(guān)軟件相關(guān)文章發(fā)表評(píng)論 來源:本站整理時(shí)間:2010/9/22 0:32:47字體大。A-A+

作者:佚名點(diǎn)擊:2741次評(píng)論:0次標(biāo)簽: IP地址 命令行

  • 類型:手機(jī)工具大。2.8M語言:中文 評(píng)分:6.8
  • 標(biāo)簽:
立即下載
@echo off
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

    相關(guān)評(píng)論

    閱讀本文后您有什么感想? 已有人給出評(píng)價(jià)!

    • 8 喜歡喜歡
    • 3 頂
    • 1 難過難過
    • 5 囧
    • 3 圍觀圍觀
    • 2 無聊無聊

    熱門評(píng)論

    最新評(píng)論

    第 1 樓 清華大學(xué)CZ88.NET 網(wǎng)友 客人 發(fā)表于: 2011/3/8 13:32:02
    改不了~~~

    支持( 0 ) 蓋樓(回復(fù))

    發(fā)表評(píng)論 查看所有評(píng)論(0)

    昵稱:
    表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
    字?jǐn)?shù): 0/500 (您的評(píng)論需要經(jīng)過審核才能顯示)