win7 批處理自動 修改本地IP地址、無線IP地址.bat

來源:互聯網
上載者:User
@echo off title Alpha - IP地址修改工具 MODE con: COLS=80 lines=20rem IP地址清單set lname=本地串連rem 本地串連IP地址一 公司IP地址set lAdd1=192.168.3.126 set lmask1=255.255.252.0 set lGat1=192.168.3.254 set ldns11=202.96.199.133 set ldns12=202.106.196.115 rem 本地串連IP地址二 家庭IP地址set lAdd2=192.168.0.115 set lmask2=255.255.255.0 set lGat2=192.168.0.1 set ldns21=202.96.199.133 set ldns22=202.106.196.115set wname=無線網路串連rem 無線串連IP地址一 公司IP地址set wAdd1=%lAdd1% set wmask1=%lmask1% set wGat1=%lGat1% set wdns11=%ldns11% set wdns12=%ldns12% rem 無線串連IP地址二 家庭IP地址set wAdd2=%lAdd2% set wmask2=%lmask2% set wGat2=%lGat2% set wdns21=%ldns21% set wdns22=%ldns21% :home cls @echo. @echo      Alpha - IP地址修改工具    ( KYT -- PanFu )@echo. @echo           1:設定 %lname% @echo           2:設定 %wname% @echo. @echo 警告:WIN7系統必須 單擊右鍵 [以管理員身份運行(A)] !@echo. @echo. set shut=""  set /p shut="請輸入 【<1> 或 <2> 或 <q>退出】 並按斷行符號鍵 :" IF NOT "%shut%"=="" (  if %shut% NEQ "" SET shut=%shut:~0,1%  ) else (  set shut="")  if /i %shut%==1 goto locally if /i %shut%==2 goto wireless if /i %shut%==q exit goto home:locally cls @echo. @echo      修改 %lname% IP地址      ( KYT -- PanFu )@echo. @echo           1:設定 %lname% 自動擷取IP地址@echo           2:設定 %lname% IP地址為公司IP %lAdd1% @echo           3:設定 %lname% IP地址為專用IP %lAdd2% @echo. @echo. set shut=""  set /p shut="請輸入 【<1> 或 <2> 或 <3> 或 <q>退出】 並按斷行符號鍵 或者 按<斷行符號鍵>返回主菜單 :" IF NOT "%shut%"=="" (  if %shut% NEQ "" SET shut=%shut:~0,1%  ) else (  set shut="")  if /i %shut%==1 goto locallyone if /i %shut%==2 goto locallytwo if /i %shut%==3 goto locallythree if /i %shut%==q exit goto home:wireless cls @echo. @echo      修改 %wname% IP地址      ( KYT -- PanFu )@echo. @echo           1:設定 %wname% 自動擷取IP地址@echo           2:設定 %wname% IP地址為公司IP %wAdd1% @echo           3:設定 %wname% IP地址為專用IP %wAdd2% @echo. @echo. set shut=""  set /p shut="請輸入 【<1> 或 <2> 或 <3> 或 <q>退出】 並按斷行符號鍵 或者 按<斷行符號鍵>返回主菜單 :" IF NOT "%shut%"=="" (  if %shut% NEQ "" SET shut=%shut:~0,1%  ) else (  set shut="")  if /i %shut%==1 goto wirelessone if /i %shut%==2 goto wirelesstwo if /i %shut%==3 goto wirelessthree if /i %shut%==q exit goto homerem  設定 本網串連 開始:locallyone @echo. @echo 正在設定 %lname% IP地址 請稍後。。。call :autolocall %lname% >nul @echo 設定 %lname% 自動擷取IP地址成功!!@echo. @echo. goto three:locallytwo @echo. @echo 正在設定 %lname% IP地址 請稍後。。。call :autowireless %wname% >nul cmd /c netsh interface ip set address name="%lname%" static %ladd1% %lmask1% %lGat1% >nul cmd /c netsh interface ip add dns name="%lname%" %ldns11% index=1 >nul cmd /c netsh interface ip add dns name="%lname%" %ldns12% index=2 >nul @echo 設定 %lname% IP地址成功!!!@echo. @echo 當前IP地址:   %ladd1% @echo 當前子網路遮罩: %lmask1% @echo 當前預設閘道: %lGat1% @echo 當前DNS1地址:%ldns11% @echo 當前DNS2地址:%ldns12% @echo. @echo. goto three:locallythree @echo. @echo 正在設定 %lname% IP地址 請稍後。。。call :autowireless %wname% >nul cmd /c netsh interface ip set address name="%lname%" static %ladd2% %lmask2% %lGat2% >nul cmd /c netsh interface ip add dns name="%lname%" addr=%ldns21% index=1 >nul cmd /c netsh interface ip add dns name="%lname%" addr=%ldns22% index=2 >nul @echo 設定 %lname% IP地址成功!!!@echo. @echo 當前IP地址:   %ladd2% @echo 當前子網路遮罩: %lmask2% @echo 當前預設閘道: %lGat2% @echo 當前DNS1地址:%ldns21% @echo 當前DNS2地址:%ldns22% @echo. @echo. goto three :: 設定 本網串連 結束::  設定 無線網路串連 開始:wirelessone @echo. @echo 正在設定 %wname% IP地址 請稍後。。。call :autowireless %wname% >nul @echo 設定 %wname% 自動擷取IP地址成功!!@echo. @echo. goto three:wirelesstwo @echo. @echo 正在設定 %wname% IP地址 請稍後。。。call :autolocall %lname% >nul cmd /c netsh interface ip set address name="%wname%" static %wadd1% %wmask1% %wGat1% >nul cmd /c netsh interface ip add dns name="%wname%" %wdns11% index=1 >nul cmd /c netsh interface ip add dns name="%wname%" %wdns12% index=2 >nul @echo 設定 %wname% IP地址成功!!!@echo. @echo 當前IP地址:   %wadd1% @echo 當前子網路遮罩: %wmask1% @echo 當前預設閘道: %wGat1% @echo 當前DNS1地址:%wdns11% @echo 當前DNS2地址:%wdns12% @echo. @echo. goto three:wirelessthree @echo. @echo 正在設定 %wname% IP地址 請稍後。。。call :autolocall %lname% >nul cmd /c netsh interface ip set address name="%wname%" static %wadd2% %wmask2% %wGat2% >nul cmd /c netsh interface ip add dns name="%wname%" %wdns121% index=1 >nul cmd /c netsh interface ip add dns name="%wname%" %wdns122% index=2 >nul @echo 設定 %wname% IP地址成功!!!@echo. @echo 當前IP地址:   %wadd2% @echo 當前子網路遮罩: %wmask2% @echo 當前預設閘道: %wGat2% @echo 當前DNS1地址:%wdns21% @echo 當前DNS2地址:%wdns22% @echo. @echo. goto three :: 設定 無線網路串連 結束:three ::pause >nul set shut=""  set /p shut="請輸入 【<a>返回主菜單】 或者 按<其他鍵>退出:" IF NOT "%shut%"=="" (  if %shut% NEQ "" SET shut=%shut:~0,1%  ) else (  set shut="")  if /i %shut%==a goto home exit:autolocall cmd /c netsh interface ip set address name="%lname%" static 0.0.0.0  0.0.0.0  0.0.0.0 >nul cmd /c netsh interface ip set address name="%lname%" source=dhcp >nul cmd /c netsh interface ip set dns name="%lname%" source=dhcp >nul ::@echo 設定 %lname% 自動擷取IP地址成功!goto :eof:autowireless cmd /c netsh interface ip set address name="%wname%" static 0.0.0.0  0.0.0.0  0.0.0.0 >nul cmd /c netsh interface ip set address name="%wname%" source=dhcp >nul cmd /c netsh interface ip set dns name="%wname%" source=dhcp >nul ::@echo 設定 %wname% 自動擷取IP地址成功!goto :eof

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.