标题: [系统相关] 求助批处理修改网卡MAC,然后停用启用本地连接,有大神赐教吗? [打印本页]
作者: 26442784 时间: 2022-6-11 22:19 标题: 求助批处理修改网卡MAC,然后停用启用本地连接,有大神赐教吗?
求助一个修改网卡MAC,然后停用启用本地连接的批处理,有大神赐教吗?
作者: LJY4.0 时间: 2022-6-12 09:08
我没测试- @echo off
- echo 修改中......
- @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010" /v NetworkAddress /t reg_SZ /d 00EA0117F854 /f
- @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010\Ndi\params\NetworkAddress" /v default /t reg_SZ /d 00EA0117F854 /f
- @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010\Ndi\params\NetworkAddress" /v ParamDesc /t reg_SZ /d MAC-Address /f
- @reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010\Ndi\params\NetworkAddress" /v Optional /t reg_SZ /d 1 /f
- devcon disable *DEV_8139*
- devcon enable *DEV_8139*
- netsh interface set interface name="本地连接" admin=disabled
- netsh interface set interface name="本地连接" admin=enabled
- cls
- echo 修改完成
- pause>nul
- exit
复制代码
作者: flashercs 时间: 2022-6-12 09:12
- @echo off
- @REM 开始设置MAC...
- for /f "tokens=1" %%A in ('wmic path Win32_NetworkAdapter where "NetConnectionID='本地连接'" get DeviceID^,InterfaceIndex^,MACAddress /value^|find "="') do (
- set %%A
- )
- set DeviceID=0000%DeviceID%
- set DeviceID=%DeviceID:~-4%
- REM echo DeviceID = %DeviceID%
- set newMACAddress=002D7538A0D2
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}\%DeviceID%" /v "NetworkAddress" /t REG_SZ /d "%newMACAddress%" /f
- @REM 启用禁用网卡
- netsh interface set interface name="本地连接" admin=Disabled
- netsh interface set interface name="本地连接" admin=Enabled
- pause
- exit /b
复制代码
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |