I am developing an installer using Wix and need to kill a process (not application) silently during installation so the user doesn't get a pop up asking to kill the process or wait and restart. I have seen solutions for killing an application but not a process.
How to kill a process from WiX
Hi @Monofilament how did you solve it? cause i'm doing the same thing as the marked answer but it doesn't work for me. i'm using win 10 thanks –
Opalina
@ElamirOhana This was years ago and I haven't worked with WiX since, however there is a comment on the selected answer (that worked for me) regarding the new version of WiX, maybe that can help you figure it out: "From the docs, CAQuietExec will be unavailable in 4.0. There are equivalent replacements at the link. – Will" –
Monofilament
After some digging around I found this solution which uses the WixUtilExtension Quiet Execution Custom Action http://wix.sourceforge.net/manual-wix3/qtexec.htm:
<InstallExecuteSequence>
<Custom Action='MyProcess.TaskKill' Before='InstallValidate'/>
</InstallExecuteSequence>
<Property Id="QtExecCmdLine"
Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM MyProcess.exe'/>
<CustomAction Id="MyProcess.TaskKill"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="immediate"
Return="ignore"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="WindowsFolder" Name="WINDOWS"/>
...
Is there a possiblity to get this working for proecesses which are running with admin rights? Currently this wont work if a process i running at an admin account cause the qtexec has not enough rights to kill the process. –
Coranto
Be carefull taskkill is not available in the HOME editions of windows. –
Jackhammer
From the docs, CAQuietExec will be unavailable in 4.0. There are equivalent replacements at the link. –
Lilialiliaceous
btw, if your app can process the WM_CLOSE message properly, then you don't need to use the /F flag. –
Embrocation
I have used the CloseApplication
element to do this, if I understand your needs. The processes I killed don't show as applications in Task Manager. Depends on what process class you're talking about, though.
© 2022 - 2024 — McMap. All rights reserved.