- @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
复制代码
|