设置环境变量需要在 64 位上重新启动 [英] Setting environment variables requires reboot on 64-bit
问题描述
我正在使用需要设置系统 PATH 环境变量的 Wix 3.5 安装程序.
I am working on an installer using Wix 3.5 that needs to set the system PATH environment variable.
这就是我设置环境变量的方式:
This is how I am setting the environment variable:
<Directory Id="DirectoryName">
<Component Id="ComponentID" Guid="{BE20AF67-5943-4AF4-BE66-226E2D4B844F}">
<Environment Id="EnvironmentID" Name="PATH" Action="set" Value="the path" Part="last" Separator=";" System="yes" />
</Component>
</Directory>
这似乎适用于 32 位系统,无需重新启动即可识别更改.但是,当我在 64 位 Windows 7 上尝试时,需要重新启动.
This seems to be working on 32-bit systems without requiring a reboot for the changes to be recognized. However, when I try it on 64-bit Windows 7 a reboot is required.
这是 64 位系统上的已知问题吗?
Is this a known issue on 64-bit systems?
也许最好的方法是安排重新启动以覆盖所有基地.
Maybe the best approach would be to schedule a reboot to cover all bases.
谢谢,艾伦
推荐答案
在ServerFault上查看这个问题:如何在不重启的情况下添加 Windows 环境变量?
Check this question on ServerFault: How do you add a Windows environment variable without rebooting?
因此,要将更改传播到环境变量列表,您可以编写一个广播 WM_SETTINGCHANGE
消息,如知识库文章 如何传播系统的环境变量.
So to propagate the change to the list of environment variables, you can write a small program which broadcasts WM_SETTINGCHANGE
message as described in KB article How to propagate environment variables to the system.
这篇关于设置环境变量需要在 64 位上重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!