您好,登錄后才能下訂單哦!
因為經常出差,每次修改IP都覺得特別麻煩。然后就想到可以用批處理的方式修改IP地址,通過查資料、測試,終于找到了可以在win10下修改IP的批處理(需要以管理員權限運行),不過還不是很完善。
ECHO OFFREM QBFC Project Options BeginREM HasVersionInfo: NoREM Companyname: REM Productname: REM Filedescription: REM Copyrights: REM Trademarks: REM Originalname: REM Comments: REM Productversion: 0. 0. 0. 0REM Fileversion: 0. 0. 0. 0REM Internalname: REM Appicon: 2.icoREM QBFC Project Options EndECHO ON@echo off :: BatchGotAdmin :-------------------------------------自動獲得管理員權限,臨時 REM --> Check for permissions >nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" REM --> If error flag set, we do not have admin. if '%errorlevel%' NEQ '0' ( echo Requesting administrative privileges... goto UACPrompt ) else ( goto gotAdmin ) :UACPrompt echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs" "%temp%\getadmin.vbs" exit /B :gotAdmin if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" ) pushd "%CD%" CD /D "%~dp0" :--------------------------------------
color 1
set /p choice= 1.設置公司IP 2.IP自動獲取 3.結束 4.測試 您的選擇:
echo.
if "%choice%"=="1" goto ip1
if "%choice%"=="2" goto ip2
if "%choice%"=="3" goto end
if "%choice%"=="4" goto test
goto main
:ip1
echo IP自動設置開始....
echo.
echo 正在設置IP及子網掩碼
cmd /c netsh interface ip set address name="以太網" source=static addr=192.168.62.178 mask=255.255.255.0 gateway=192.168.62.1 gwmetric=1
cmd /c netsh interface ip set dnsservers "以太網" static 114.114.114.114 primary
netsh interface ip add dnsservers "以太網" 8.8.8.8 index=2
echo 設置完成
pause
exit
if errorlevel 2 goto main
if errorlevel 1 goto end
:ip2
color 2
echo IP自動設置開始....
echo.
echo 自動獲取IP地址....
netsh interface ip set address name = "以太網" source = dhcp
echo 自動獲取DNS服務器....
netsh interface ip set dns name = "以太網" source = dhcp
@rem 設置自動獲取IP
echo 設置完成
pause
exit
if errorlevel 2 goto main
if errorlevel 1 goto end
:test
netsh inte***ce ip set address name = "以太網" source = dhcp
netsh inte***ce ip set dns name = "以太網" source = dhcp
netsh inte***ce ip set wins name = "以太網" source = dhcp
CHOICE /C YN /M "退出請按 Y,返回菜單請按 N。"
if errorlevel 2 goto main
if errorlevel 1 goto end
:end
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。