|
|
|
|
#1 |
|
Senior Member
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
|
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 |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
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... IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
|
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... |
|
|
|
|
|
#4 | |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx says
Quote:
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
|
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! |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: May 2005
Location: New Zealand
Posts: 916
|
I've created a plugin that deals with environment variables, check it out here: http://nsis.sourceforge.net/EnVar_plug-in.
"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me) NSIS 3 POSIX Ninja Wiki Profile |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|