Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(chocolatey#310) Set-EnvironmentVariable: delete values properly
We noticed over the last few days that the previous version of this code was *adding* blank values into the registry, which caused some issues with how environment variables are applied to new processes. Specifically, if a Machine-level variable is set, and a User-level variable by the same name is set to a blank value, new processes do not properly inherit the Machine-level value and it remains blank/unset. This change ensures that if someone sets an environment variable to a blank value, it will be properly *deleted* rather than set to a blank value. Additionally, a minor change has been made to Update-SessionEnvironment to ensure that if there are somehow blank values in the registry, it can sidestep those issues if it is called.
- Loading branch information