使用环境变量工作目录设置 Wix 快捷方式 [英] Setting Wix shortcut with environment variable workingdirectory

查看:19
本文介绍了使用环境变量工作目录设置 Wix 快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下 WorkingDirectory 在 WIX 中创建快捷方式:

I'm trying to create a shortcut in WIX with teh following WorkingDirectory:

<Shortcut Id="PowerShellShortcut" Name="$(var.PRODUCTNAME) Powershell Prompt" Description="$(var.PRODUCTNAME) Powershell Prompt" WorkingDirectory="%HOMEDRIVE%%HOMEPATH%" Target="[POWERSHELLEXE]" Arguments='-noexit -command "Import-Module [APPLICATIONFOLDER]Binaries\MA.dll | Out-Null"' />

当我尝试构建时出现以下错误:

When I try to build I get the following error:

错误 1 ​​Shortcut/@WorkingDirectory 属性的值%HOMEDRIVE%%HOMEPATH%"不是合法标识符.标识符可以包含 ASCII 字符 A-Z、a-z、数字、下划线 (_) 或句点 (.).每个标识符必须以字母或下划线开头.

Error 1 The Shortcut/@WorkingDirectory attribute's value, '%HOMEDRIVE%%HOMEPATH%', is not a legal identifier. Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.). Every identifier must begin with either a letter or an underscore.

是否有解决方法可以将文字字符串%HOMEDRIVE%%HOMEPATH%"设置为快捷方式的工作目录?

Is there a workaround to set the literal string "%HOMEDRIVE%%HOMEPATH%" as the WorkingDirectory of a Shortcut?

推荐答案

根据 快捷方式表,工作目录 (WkDir) 存储了一个属性的名称,该属性具有您想要存储到快捷方式中的值.这个属性可能是一个 DirProperty(即也是对目录表的引用),或者它可能只包含一个硬编码的字符串本身.如果您希望最终快捷方式具有文字文本 %HOMEDRIVE%%HOMEPATH%,则将您的工作目录设置为类似 WKDIR_HOME 的内容,这是您拥有的属性的名称设置为 %HOMEDRIVE%%HOMEPATH%.

Per the documentation on the Shortcut Table, the working directory (WkDir) stores the name of a property that has the value you want stored into the shortcut. This property may be a DirProperty (i.e. also a reference into the Directory Table), or it may just hold a hardcoded string itself. If you want the final shortcut to have the literal text %HOMEDRIVE%%HOMEPATH%, then set your working directory to something like WKDIR_HOME which is the name of a property you have set to %HOMEDRIVE%%HOMEPATH%.

这篇关于使用环境变量工作目录设置 Wix 快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆