Forum Discussion
Pollewops
Sep 21, 2021Iron Contributor
How to set Environment Variables
Tim Mangan I tried to set a environment variable using HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment, but that is not being picked up by the package. The configured ...
Pollewops
Sep 30, 2021Iron Contributor
TIMOTHY_MANGAN We did some further testing with the variables and found out the following.
Using the examples decribed in https://github.com/TimMangan/MSIX-PackageSupportFramework/blob/develop/fixups/EnvVarFixup/readme.md we use:
{
"dll": "EnvVarFixup.dll",
"config": {
"EnvVars": [{
"name": "ENVTEST1",
"value": "Test1!",
"useregistry": "false"
},
But this is not working. Why, because in the code the envVars is case-sensitive. When using envVars it is all working 😉 EnvVars is wrong and envVars is working.
According to the debug logs we see it is working.
However when starting a cmd and dump the environment variables, we do not see them available. Any idea why?
Sep 30, 2021
Thanks for the note on case sensitivity. Yes, the json is case sensitive and apparently the readme is incorrect; in that case I'll update the readme.
As to the other question, the package environment variables are not implemented in a list form (we have no intercept for that), but if you were to try to use the variable in a command inside that cmd window you should find that it works. As I don't see apps trying to list the variables before using them I don't think we need to fix that. But let me know if I'm wrong about that.
As to the other question, the package environment variables are not implemented in a list form (we have no intercept for that), but if you were to try to use the variable in a command inside that cmd window you should find that it works. As I don't see apps trying to list the variables before using them I don't think we need to fix that. But let me know if I'm wrong about that.
- PollewopsSep 30, 2021Iron ContributorSo in a cmd, the SET command wont’t list the configured variable, but an ECHO %TESTVAR% does or should display it?
- Sep 30, 2021As long as the cmd is running in the container with EnVarFixup, yes. At least that is the plan...
- Sep 30, 2021You should check the config.json file. I'm not sure if PsfTooling covers this case, but TMEditX should.
PsfTooling tries to be more surgical and not apply things where they aren't needed by default, whereas TMEdit by default tries to cover everything.
So with PsfTooling the Processes section tries to set a process match based on the individual shortcut target and it probably does not handle the shell launch cases (cmd, txt, pdf, etc files). You might need to manually change the process to ".*" which is what TMEditX does.