This is a follow-up to Set Permanent Environmental Variable in Windows XP.
I want to change System variables in XP through running a bat file. But when I run it I get the error "Too many command-line parameters"
This is the code:
set KEY="HKLM\SYSTEM\CurrentControlSet\Control\Sessions Manager\Environment"
set PATHxx=%Path%
reg add %KEY% /v Pathx /t REG_EXPAND_SZ 5 /d %PATHxx%How can I fix this?
01 Answer
Should the 5 be in there?
You've probably got spaces in your path
Try this:
set KEY="HKLM\SYSTEM\CurrentControlSet\Control\Sessions Manager\Environment"
set PATHxx=%Path%
reg add %KEY% /v Pathx /t REG_EXPAND_SZ /d "%PATHxx%"You also might want to include:
5/f - Force overwriting the existing registry entry without prompt