[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. pushd "%~dp0\"
  3. SetLocal EnableDelayedExpansion
  4. set Adapter="NVIDIA nForce Networking Controller"
  5. rem 你的网络设备名称
  6. set Fullkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class"
  7. echo.正在导出注册表文件...
  8. regedit.exe /e %temp%\clsid.reg %Fullkey%
  9. echo.正在分析注册表文件...
  10. for /f "delims=:" %%a in ('Type "%temp%\clsid.reg" ^| findstr /ni /c:%Adapter%') do (
  11. for /l %%i in (100,-1,1) do (
  12. set /a Line = %%a - %%i
  13. for /f "tokens=2 delims=:" %%b in ('Type "%temp%\clsid.reg" ^| findstr /n .* ^| findstr /b !Line!:') do (
  14.                 echo.%%b | findstr /i %Fullkey% >nul 2>nul
  15. if !errorlevel! == 0 set CLSID=%%b
  16. )
  17. )
  18. )
  19. ECHO.%CLSID:~1,-1%
  20. erase "%temp%\clsid.reg"
  21. echo.按任意键退出...
  22. pause >nul
复制代码

TOP

  1. rem 单网卡(Intel 21140-Based PCI Fast Ethernet Adapter (Generic))、XPSP3下测试通过
  2. @echo off
  3. pushd "%~dp0\"
  4. SetLocal EnableDelayedExpansion
  5. rem 下面两行请自行修改
  6. set NetConnectionID=本地连接
  7. set NetworkAddress=111122223333
  8. set Fullkey="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class"
  9. rem 获取“本地连接”的设备名称
  10. for /f "delims=" %%a in ('wmic nic where "netconnectionid='%NetConnectionID%'" get name /value') do call set %%a>nul 2>nul
  11. regedit.exe /e %temp%\clsid.reg %Fullkey%
  12. rem 分析注册表
  13. echo.正在分析注册表文件...
  14. for /f "delims=:" %%a in ('Type "%temp%\clsid.reg" ^| findstr /ni /c:"%name%"') do (
  15. for /l %%i in (100,-1,1) do (
  16. set /a Line = %%a - %%i
  17. for /f "tokens=2 delims=:" %%b in ('Type "%temp%\clsid.reg" ^| findstr /n .* ^| findstr /b !Line!:') do (
  18.             echo.%%b | findstr /i %Fullkey% >nul 2>nul
  19. if !errorlevel! == 0 set CLSID=%%b
  20. )
  21. )
  22. )
  23. rem 使用reg add命令修改物理地址
  24. reg add "%CLSID:~1,-1%" /v NetworkAddress /d %NetworkAddress% /f
  25. rem 禁用网卡
  26. netsh interface set interface "本地连接" disable
  27. rem 启用网卡
  28. netsh interface set interface "本地连接" enable
  29. erase "%temp%\clsid.reg"
  30. echo.按任意键退出...
  31. pause >nul
复制代码
不过,我不敢保证 netsh 能启用、禁用网卡...
1

评分人数

TOP

回复 8# ygqiang
那两个操作只是复制你一楼的代码,我在上面也讲了,不保证netsh启用、禁用网卡有效...

TOP

返回列表