how i can append data to the registry values of type RG_EXPAND_SZ using reg add command?

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.

ZOLDIK

Posted 2019-08-07T08:58:24.790

Reputation: 1

1REG.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 – 2019-08-07T10:29:49.853

@Akina thanks I understand, that's what I was thinking of as a side solution. – ZOLDIK – 2019-08-07T13:23:06.053

Simple batch - query value, store into variable, append, save back. – Akina – 2019-08-07T13:32:13.940

No answers