|
|
楼主 |
发表于 2011-9-25 16:33:34
|
显示全部楼层
解决了。- rem 单网卡(Intel 21140-Based PCI Fast Ethernet Adapter (Generic))、XPSP3下测试通过
- @echo off
- pushd "%~dp0\"
- SetLocal EnableDelayedExpansion
- rem 下面两行请自行修改
- set NetConnectionID=本地连接
- set NetworkAddress=002170BC708E
- set Fullkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class"
- rem 获取“本地连接”的设备名称
- for /f "delims=" %%a in ('wmic nic where "netconnectionid='%NetConnectionID%'" get name /value') do call set %%a>nul 2>nul
- regedit.exe /e %temp%\clsid.reg %Fullkey%
- rem 分析注册表
- echo.正在分析注册表文件...
- for /f "delims=:" %%a in ('Type "%temp%\clsid.reg" ^| findstr /ni /c:"%name%"') do (
- for /l %%i in (100,-1,1) do (
- set /a Line = %%a - %%i
- for /f "tokens=2 delims=:" %%b in ('Type "%temp%\clsid.reg" ^| findstr /n .* ^| findstr /b !Line!:') do (
- echo.%%b | findstr /i %Fullkey% >nul 2>nul
- if !errorlevel! == 0 set CLSID=%%b
- )
- )
- )
- rem 使用reg add命令修改物理地址
- reg add "%CLSID:~1,-1%" /v NetworkAddress /d %NetworkAddress% /f
- rem 禁用网卡
- for /f "tokens=2 delims=&" %%a in ('devcon find pci\*^|findstr /c:"Fast Ethernet"') do (
- devcon DISABLE *%%a*>NUL
- )
- rem 启用网卡
- for /f "tokens=2 delims=&" %%a in ('devcon find pci\*^|findstr /c:"Fast Ethernet"') do (
- devcon ENABLE *%%a*>NUL
- )
- erase "%temp%\clsid.reg"
- exit
复制代码 xp sp3系统下测试通过。
其中的devcon从这里下载。
http://bbs.bathome.net/thread-743-1-1.html |
|