本帖最后由 x9tiancmd 于 2011-11-9 13:24 编辑
- @echo off
-
- Setlocal Enabledelayedexpansion
- for /f "tokens=1-3 delims= " %%i in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v Path^|find "Path"') do (
- set "path_=%%k"
- if not !path_:~-1!_==;_ set Path_=!Path_!;
- reg add "HKLM\System\CurrentControlset\Control\Session Manager\Environment" /v %%i /t %%j /d !path_!d:\bin /f
-
- )
- pause
- ::己解决,PATH 是系统变量,改个变量名就没事了 将Path 改成Path_
-
复制代码
- @echo off
-
- Setlocal Enabledelayedexpansion
- for /f "tokens=1-3 delims= " %%i in ('reg query "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" /v Path^|find "Path"') do (
- set "path_=%%k"
- if not !path_:~-1!_==;_ set Path_=!Path!;
- call :a %%i %%j "!Path_!d:\bin"
-
- )
- pause
- :a
- endlocal
- reg add "HKLM\System\CurrentControlset\Control\Session Manager\Environment" /v %1 /t %2 /d %3 /f
- goto :eof
- ::己解决,PATH 是系统变量,改个变量名就没事了 将Path 改成Path_
复制代码 [ |