![]() |
x86/x64 Environment Variables Read/Write
Hi all,
i need to modify an EnvironmentVariable in both the x86 and the x64 environment of a machine (Windows 2008/12/16). I was playing around with the x64.nsh, but that didn't get me anywhere. The variable to be modified is PSModulePath and i need to append a path to it, and depending on the environment this is later used in, it is either x86 (C:\Program Files (x86)\...) or x64 (C:\Program Files\....). Any ideas? Thanks for your help. x |
Do you want to make a permanent change by writing to the registry or temporary for programs started by your installer?
It sounds to me like you are talking about the former and then you need to use SetRegView when dealing with the registry... |
It supposed to be permanent, the problem with the registry is that the Variable "PSModulePath" in "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" does not reflect what is actually available in Powershell
Also (as far as i know) there is no different x86/x64 view in that part of the registry... |
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx says
Quote:
|
I actually knew that page, seems like even with glasses thorough reading is not automatic :)
I guess i will go with $CurrentValue = [Environment]::GetEnvironmentVariable("PSModulePath", "Machine") [Environment]::SetEnvironmentVariable("PSModulePath", $CurrentValue + ";C:\Program Files\Fabrikam\Modules", "Machine") This still needs to be done for both x86 and x64 but that is easy to handle from NSIS. Thanks for your help! |
I've created a plugin that deals with environment variables, check it out here: http://nsis.sourceforge.net/EnVar_plug-in.
|
| All times are GMT. The time now is 17:44. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.