@echo off echo 正在获取管理员权限... net session >nul 2>&1 if %errorLevel% == 0 ( echo 已获取管理员权限. ) else ( echo 获取管理员权限失败,请以管理员身份运行此脚本. pause exit )

echo 正在获取当前正在使用的网卡... for /f 'tokens=2 delims=:' %%a in ('ipconfig ^| findstr /c:"Ethernet adapter"') do ( set adapter=%%a ) set adapter=%adapter:~1%

echo 当前正在使用的网卡是:%adapter%

echo 正在设置IP地址... netsh interface ipv4 set address name='%adapter%' static 192.168.1.100 255.255.255.0 192.168.1.1 echo IP地址设置成功.

pause

使用bat脚本以管理员模式更改网络适配器IP地址

原文地址: https://www.cveoy.top/t/topic/nmgw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录