Windows environment variables and manual registry editing - no/wrong values issue

You need to broadcast the WM_SETTINGCHANGE Message.

Remember: You're not actually setting any environment variables of any form when you modify the registry. Environment variables are part of each individual process' memory space, with each process having its own set. They don't live in the registry. You are changing a template. You need to persuade the programs that set actual environment variables to re-read the template and set their environments accordingly. You do that by broadcasting a Windows message that tells any interested parties that the template in the registry has changed. Microsoft Windows Explorer is one such interested party, and modifies its own environment variables whenever it hears that the template has changed. These modifications are then inherited in the normal way by any new process that Explorer spawns.