【发布时间】:2019-02-26 18:14:26
【问题描述】:
我们通过 Windows 安装程序 (msi) 安装了一个桌面应用程序,我们希望添加一个自定义操作,当我们将 LAUNCH_APP=1 传递给 cmd 时重新启动 .exe。
所以我有一个 vbs 脚本,它启动一个启动安装 msi 的 bat 文件(主要升级):
vbs 脚本:
Set WshShell = CreateObject("WScript.Shell")
Const TemporaryFolder = 2
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder)
WshShell.Run chr(34) & WScript.Arguments(0) & chr(34) & chr(32) & chr(34) & tempFolder & "\Lifen\update\LifenInstaller.msi" & chr(34) & chr(32) & chr(34) & WScript.Arguments(1) & chr(34), 0, True
Set WshShell = Nothing
bat 脚本:
@echo off
call :start >%APPDATA%\Lifen\batMsiLog.log
:start
wmic process where "name='Lifen.exe'" delete
start /wait msiexec /i %1 /qn /norestart /log %APPDATA%\Lifen\msilog.log LAUNCH_APP=1
在我的 wix 安装程序(wix 版本 3.1.0)中有这个自定义操作:
<Property Id="WixQuietExecCmdLine" Value='"[INSTALLFOLDER]\Lifen.exe"'/>
<CustomAction Id="QtExecRestartApp" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="check"/>
<InstallExecuteSequence>
<Custom Action="QtExecRestartApp" After="InstallFinalize">LAUNCHAPP = 1</Custom>
</InstallExecuteSequence>
我不知道如何在自定义操作中添加参数(如 —new-version)以重新启动我的 exe。
最后,我想运行命令:
Lifen.exe —new-version
我尝试了各种写法:
'"[INSTALLFOLDER]\Lifen.exe --new-version=x.x.x"''"[INSTALLFOLDER]\Lifen.exe" "--new-version=x.x.x"'
或者在阅读此 * 之后:How to add arguments to the custom action exe in Wix?
'"&quot;[#"[INSTALLFOLDER]\Lifen.exe"]"&quot; "--new-version"''"&quot;[#"[INSTALLFOLDER]\Lifen.exe"]"&quot; "--new-version"'
有人有想法吗?
提前致谢
【问题讨论】:
标签: wix exe command-line-arguments custom-action