本帖最后由 CrLf 于 2012-8-11 19:05 编辑
尽量仿楼主代码:- @echo off
- set "arrPath="
- if exist C:\Drs\ (call :FolderTree C:\Drs\) else exit
- if exist E:\nt5_Driver\ (call :FolderTree E:\nt5_Driver\) else exit
-
- set sDevicePath="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath"
- reg add %sDevicePath% /t REG_EXPAND_SZ /d "%SystemRoot%\inf;%arrPath%"
-
- goto :eof
-
- :FolderTree
- for /f "delims=" %%a in ('dir /s /b /ad"%~1"^|sort) do (
- set "path=%%a"
- setlocal enabledelayedexpansion
- set "sDevicePath=!sDevicePath!!path!;"
- endlocal
- )
复制代码
|