我们通过 Windows 安装程序 (msi) 安装了一个桌面应用程序,并且希望添加一个自定义操作,以便在通过后重新启动 .exeLAUNCH_APP=1
to the cmd
.
所以我有一个 vbs 脚本来启动一个bat文件来启动安装msi(主要升级):
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
蝙蝠脚本:
@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"'
或者在阅读此 stackoverflow 之后:如何在 Wix 中向自定义操作 exe 添加参数? https://stackoverflow.com/questions/42575629/how-to-add-arguments-to-the-custom-action-exe-in-wix
'""[#"[INSTALLFOLDER]\Lifen.exe"]"" "--new-version"'
'""[#"[INSTALLFOLDER]\Lifen.exe"]"" "--new-version"'
有人有想法吗?
提前致谢