您好,登录后才能下订单哦!
因为经常出差,每次修改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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。