Question : Refresh System Environment Variables

Is there a way to refresh the system environment variables once a new variable is set?  I'm creating a new system variable using setx.exe.  Next, when I try to retrieve that variable using an API call, the call returns a NULL.  However, if I reboot, it works fine.  Can this be done without a reboot?

Answer : Refresh System Environment Variables

There is no way to do that without having the process be reinitialized (IOW: restarted). The process receives a copy of the parent process' environment block representing the system state when 'CreateProcess()' was caleed. Then the loader finishes the initialization and calls the program's entry point with that data.
Random Solutions  
 
programming4us programming4us