谁能给我一个在WIX中修改windows环境系统变量的例子吗?

发布于 2024-08-16 06:08:20 字数 249 浏览 9 评论 0原文

在完成 WIX 教程后,我仍然不知道如何将 installdir 添加到 Windows 系统变量的 PATH 中。

我尝试使用

  Environment Id='UpdatePath' Action='create' Name='PATH'  System='yes' Value='[INSTALLDIR]' 

但安装程序后路径没有变化。我几乎找不到 WIX 的示例代码。 请帮助我,非常感谢!

I still don't know how to add the installdir into the PATH of the Windows System Variables after I went through the WIX tutorial.

I tried to use

  Environment Id='UpdatePath' Action='create' Name='PATH'  System='yes' Value='[INSTALLDIR]' 

But there was no change in the Path after I installed the program. I can hardly find sample code of WIX anywhere.
Please help me, thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

奢欲 2024-08-23 06:08:20

您应该能够使用:

<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />

这应该向环境路径添加一个新条目,设置为[INSTALLDIR]。

You should be able to use:

<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />

This should add a new entry to the environment path, set to [INSTALLDIR].

善良天后 2024-08-23 06:08:20

另一件需要注意的是,Environment 需要放置在带有目录的组件内,例如

<DirectoryRef Id="TARGETDIR">
  <Component Id="Path" Guid="{xxx-xxx-xxx-xxx}">
    <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="no" />
  </Component>
</DirectoryRef>

环境元素

Another thing to note is, Environment need to be placed inside a component with directory, e.g.

<DirectoryRef Id="TARGETDIR">
  <Component Id="Path" Guid="{xxx-xxx-xxx-xxx}">
    <Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="no" />
  </Component>
</DirectoryRef>

Details of Wix Element described at Environment Element

会发光的星星闪亮亮i 2024-08-23 06:08:20

遇到了同样的问题,这对我有用:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="DataBaseds_Service_Installer" />
    </Directory>
</Directory>

<ComponentGroup Id="Components" Directory="INSTALLFOLDER">
 
  ...some components  
</ComponentGroup>

<DirectoryRef Id="TARGETDIR">
  <Component Id="MYSQL_PASSWORD" Guid="..."
    <Environment Id=HERE YOU CAN ADD THIS  :)/>
  </Component>      
</DirectoryRef>

Had the same exact problem, this have worked for me:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLFOLDER" Name="DataBaseds_Service_Installer" />
    </Directory>
</Directory>

<ComponentGroup Id="Components" Directory="INSTALLFOLDER">
 
  ...some components  
</ComponentGroup>

<DirectoryRef Id="TARGETDIR">
  <Component Id="MYSQL_PASSWORD" Guid="..."
    <Environment Id=HERE YOU CAN ADD THIS  :)/>
  </Component>      
</DirectoryRef>
无法言说的痛 2024-08-23 06:08:20

这段代码对我有用:

<ComponentGroup Id="ProductComponents" >
  <Component Id="Path" Directory="INSTALLFOLDER" Guid="1014136b-a934-47db-bf69-5da949b2528b">
    <CreateFolder/>
    <Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="no" />
  </Component>
</ComponentGroup>

This code is working for me:

<ComponentGroup Id="ProductComponents" >
  <Component Id="Path" Directory="INSTALLFOLDER" Guid="1014136b-a934-47db-bf69-5da949b2528b">
    <CreateFolder/>
    <Environment Id="PATH" Name="PATH" Value="[INSTALLFOLDER]" Permanent="no" Part="last" Action="set" System="no" />
  </Component>
</ComponentGroup>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文