0

I have a value names Path under "HKCU\Environment" of type RG_EXPAND_SZ which means that it is expandable, I want to add values to it, using the separator ';'

this will work:
reg add "HKCU\Environment" /v Path /t REG_EXPAND_SZ /d "e:\libs" /f
but it will remove the data that was already in that value and put the new data on it, I'm sure we can approach this by adding the /s argument but I don't know-how.

I tried to add /s to append to that value and separate them by the character ";"
reg add "HKCU\Environment" /v Path /t REG_EXPAND_SZ /s ; /d "e:\libs" /f
reg add "HKCU\Environment" /v Path /t REG_EXPAND_SZ /d "e:\libs" /s ; /f

none of them works it says
ERROR: Invalid syntax.
Type "REG ADD /?" for usage.

  • 1
    REG.EXE cannot APPEND key value. It is always overrided. So query old value into variable, append it, and store new value. PS. /s parameter is available for REG_MULTI_SZ type only. – Akina Aug 7 '19 at 10:29
  • @Akina thanks I understand, that's what I was thinking of as a side solution. – ZOLDIK Aug 7 '19 at 13:23
  • Simple batch - query value, store into variable, append, save back. – Akina Aug 7 '19 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.