Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-ChocolateyEnvironmentVariable does't create expandable variables properly #1457

Closed
jmusek opened this issue Nov 20, 2017 · 3 comments

Comments

@jmusek
Copy link

jmusek commented Nov 20, 2017

Create machine wide environment variables 'A' and 'B' using Install-ChocolateyEnvironmentVariable with values 'A' = "some_value" and 'B' = "%A%" the variable B is not expanded.

To create B variable: "Install-ChocolateyEnvironmentVariable -VariableName 'B' -VariableValue '%A%' -VariableType Machine"

In registry ('Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' both values are created as type 'REG_SZ', but correctly type of 'B' should be 'REG_EXPAND_SZ' to ensure system loads variables in correct order.
As a workaround SETX could be called which creates proper type.

@jmusek jmusek changed the title Install-ChocolateyEnvironmentVariable does't create expandable variables Install-ChocolateyEnvironmentVariable does't create expandable variables properly Nov 20, 2017
@ferventcoder
Copy link
Member

I thought we exposed the type as a parameter to the function. I could be thinking of maybe another issue where we had fixed this with the path updates but maybe had not ported it over to this function

@jmusek
Copy link
Author

jmusek commented Nov 24, 2017

There is 'VariableType {Process | User | Machine}' parameter, but that is to define scope parameter.

@ferventcoder
Copy link
Member

@jmusek I took a look as well when I mentioned this and noticed that we didn't open up the actual type in that command.

c3d4ff3

And related to #303 / #699

@jmusek jmusek closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants