Actually, read/writevalue commands are only part of the story. If you want to copy an entire subtree, you will need to play with the EnumKey and EnumValue commands as well.

EnumKey is placed in a loop (as per the example in the manual) to "discover" each subkey path. For each value returned by EnumKey, you'll need to run an inner loop using EnumValue functions - this will return the name of each value in the key. Then you'll need to use ReadValue to read the data, and ReadType to determine the registry value type - you'll need this information for WriteValue. Now that you have the key, value, data, and type, you can translate the Key path from HKLM to HKCU as you need, and then use WriteValue with the key, value, data, and type arguments. The inner loop continues until an error occurs when there are no more values, and the outer loop searches for the next subkey. This process repeats until all subkeys and values are found and copied. Of course, you need to consider recursion - processing the subkeys within subkeys.

As you can see, this is not a trivial process. There are several UDFs that search the registry, such as this one from Howard, which also references on by Jens.

Hope this helps..

Glenn
_________________________
Actually I am a Rocket Scientist! \:D