如何从WiX中杀死进程

pat*_*ley 17 wix kill process

我正在使用Wix开发一个安装程序,并且需要在安装期间以静默方式终止进程(而不是应用程序),因此用户不会弹出要求终止进程或等待并重新启动.我见过杀死应用程序但不是进程的解决方案.

pat*_*ley 34

经过一番挖掘后,我发现这个解决方案使用了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"/>
    ...
Run Code Online (Sandbox Code Playgroud)

  • 注意 taskkill 在 Windows 的 HOME 版本中不可用。 (2认同)

Ben*_*her 5

CloseApplication如果我了解您的需求,我已经使用该元素来做到这一点。我杀死的进程不会在任务管理器中显示为应用程序。不过,取决于您正在谈论的流程类别。