Set registry value with value of an existing key

(imported topic written by trickey91)

I’m trying to create a new registry key containing the value of an existing registry key. The most promising entry I’ve found in this group indicates that I should use a parameter:

parameter “atriahome” = “{(value “ProductHome” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Atria\ClearCase\CurrentVersion” of registry as string)}”

regset "

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

" “TEST_ENV”="{parameter “atriahome”}"

However, this doesn’t work.

Any suggestions?

Ron

(imported comment written by jessewk)

looks like it should work to me. Are you sure that registry key and value exist on your test machine?

(imported comment written by trickey91)

I figured out the problem…now I just need the solution.

The value of ProductHome is the pathname to a directory. The backslashes are causing the failure. If I change the value to “Test”, then it works.

So… how do you escape backslashes in an unknown value?!

(imported comment written by trickey91)

Got it.

parameter “origkey” = “{(value “ProductHome” of key “HKLM\SOFTWARE\Atria\ClearCase\CurrentVersion” of registry as string)}”

regset "

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

" “ATRIAHOME”="{escape of parameter “origkey”}"

Thanks,

Ron