加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

installer – 无法使用WIX更新“PATH”环境变量

发布时间:2020-12-14 04:24:55 所属栏目:Windows 来源:网络整理
导读:我使用以下wix片段来更新“PATH”环境变量. DirectoryRef Id="MyDir" Component Id ="setEnviroment" Guid=" xxxxx" CreateFolder / Environment Id="SET_ENV" Action="set" Name="PATH" Part="last" Permanent="no" System="yes" Value="[INSTALLLOCATION]"
我使用以下wix片段来更新“PATH”环境变量.
<DirectoryRef Id="MyDir">
   <Component Id ="setEnviroment" 
                           Guid=" xxxxx">
            <CreateFolder />
             <Environment Id="SET_ENV"
                                       Action="set"                                                                                          
                                         Name="PATH"
                                        Part="last"       
                                       Permanent="no" 
                                        System="yes" 
                         Value="[INSTALLLOCATION]" />
       </Component>
</DirectoryRef>
<Feature Id="Feature3" Title="3Feature"   
             Level="1" 
              Absent="disallow"
               AllowAdvertise="no">
           <ComponentRef Id="setEnviroment"/>
</Feature>
<InstallExecuteSequence>
    <WriteEnvironmentStrings/>
<InstallExecuteSequence/>

这最初工作,但现在它不更新环境变量.
详细日志显示此操作的执行并返回值1.
重启机器后检查.
在功能日志FeaturePublish For Feature3中,存在垃圾值,但安装成功.
请求你的帮助……
非常感谢….

我认为您使用的是INSTALLLOCATION,意思是使用INSTALLDIR.这是一个工作示例,它使用新应用程序的安装目录更新PATH环境var.
<Environment 
  Id="PATH" 
  Name="PATH" 
  Value="[INSTALLDIR]" 
  Permanent="yes" 
  Part="last" 
  Action="set" 
  System="yes" />

如果打算使用INSTALLLOCATION,并在其他地方定义它,那么请发布你的其余代码,我们将进一步深入兔子洞.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读