We have a desktop application installed through a windows installer (msi), and we want to add a custom action that relaunches the .exe when we have pass LAUNCH_APP=1
to the cmd
.
So I have a vbs script that launch a bat file that launch install the msi (major upgrade):
vbs script:
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 script:
@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
And in my wix installer (wix version 3.1.0) has this custom action:
<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>
I don't know how to add an argument (like —new-version
) to my custom action to relaunch my exe.
In the end, I would like to run the command:
Lifen.exe —new-version
I tried various ways to write it:
'"[INSTALLFOLDER]\Lifen.exe --new-version=x.x.x"'
'"[INSTALLFOLDER]\Lifen.exe" "--new-version=x.x.x"'
or also after reading this stackoverflow : How to add arguments to the custom action exe in Wix?
'""[#"[INSTALLFOLDER]\Lifen.exe"]"" "--new-version"'
'""[#"[INSTALLFOLDER]\Lifen.exe"]"" "--new-version"'
Does anyone have an idea ?
Thanks in advance