[英]CMD window remain open after wix installation runs application
使用Wix安裝程序(win 8),我有一個自定義操作,該操作將在成功安裝后使用Wix運行該應用程序:
<CustomAction Id='LaunchFile'
Directory='TARGETDIR'
Impersonate="no"
Execute="immediate"
ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe""'
Return="asyncNoWait" />
這很好用,但是由於某種原因,CMD窗口保持打開狀態,當應用程序關閉時,它也關閉。
我在Google中找不到任何類似的東西,有人遇到過類似的問題嗎?
謝謝
編輯:
我正在按照@Rolo的建議嘗試QtExecCmdLine:
<Property Id="QtExecCmdLine" Value='C:\Users\User\Desktop\tests.exe'/>
<CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
並且:
<Publish Event='DoAction' Value='QtExecExample'>(NOT Installed) AND (LAUNCHPRODUCT = 1)
</Publish>
但是什么也沒發生,日志顯示:
Action start 11:02:49: QtExecExample.
MSI (c) (E0:20) [11:02:49:911]: Invoking remote custom action. DLL: C:\Users\User\AppData\Local\Temp\MSIAD42.tmp, Entrypoint: CAQuietExec
MSI (c) (E0:EC) [11:02:49:913]: Cloaking enabled.
MSI (c) (E0:EC) [11:02:49:913]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (E0:EC) [11:02:49:913]: Connected to service for CA interface.
MSI (c) (E0!00) [11:02:49:944]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is 'C:\Users\User\Desktop\tests.exe'.
Action ended 11:02:49: QtExecExample. Return value 3.
DEBUG: Error 2896: Executing action QtExecExample failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: QtExecExample, ,
Action ended 11:02:49: FinishedForm. Return value 3.
Action ended 11:02:49: INSTALL. Return value 1.
填充在這里迷路了
而是使用“安靜執行自定義操作”。
http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html
更新:
我將不得不更新我的答案。 您應該使用WixShellExec自定義操作。 它的工作原理與Quiet Execution CA非常相似,但是它將允許您啟動應用程序而無需等待其關閉。
但是,它只能用作立即的自定義操作。
這里有您需要的完整實現示例:
http://wixtoolset.org/documentation/manual/v3/customactions/shellexec.html
像這樣編輯您的execommand
> ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe"" & exit'
編輯
> ExeCommand='"[TARGETDIR]ManagerAndControl.exe"'
我剛剛為我嘗試過此方法,並且在重新創建了您原來的問題后,該方法才起作用。 但是,在具有[TARGETDIR]的位置,我使用[INSTALLDIR]-我認為這是在引用您的安裝目錄。 您需要注意對逗號的使用。
感謝您的幫助,終於我解決了:
<Property Id="WixShellExecTarget" Value='[TARGETDIR]ManagerAndControl.exe' />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<!-- UI code here -->
<Publish Event='DoAction' Value='LaunchApplication'>(NOT Installed) AND (LAUNCHPRODUCT = 1)</Publish>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.