使wix脚本在启动文件夹中删除文件并终止进程

时间:2018-02-19 08:48:08

标签: wix

我是Wix的新手,我正在创建一个脚本,除了其他东西之外,如果它正在运行,还需要杀死它。在使用msi进行安装之前,我还需要从应用程序的早期版本中放置的启动文件夹中删除文件。

我当前的自定义操作如下所示:

   <InstallExecuteSequence>
     <Custom Action='KillSuperbolt' Before='InstallValidate'/>
     <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
  </InstallExecuteSequence>

  <Property Id="QtExecCmdLine" 
      Value='"[WindowsFolder]\System32\taskkill.exe" /F /T /IM Superbolt.exe'/>

  <CustomAction Id="KillSuperbolt" 
          BinaryKey="WixCA" 
          DllEntry="CAQuietExec" 
          Execute="immediate" 
          Return="ignore"/>

  <CustomAction Id="LaunchInstalledExe"
     FileKey="SuperboltLauncherExe"
     ExeCommand="" 
     Execute="immediate" 
     Impersonate="yes" 
     Return="asyncNoWait" />

我尝试按照这篇文章进行操作:http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/multiple-immediate-Quiet-Execution-custom-actions-td7591578.html

但是我不能有两个属性ID =“QtExecCmdLine”,并且它没有提供任何关于如何使用自定义操作连接属性的线索。

1 个答案:

答案 0 :(得分:0)

我自己找到了答案,并且在执行第二个命令之前更改了属性的值:

  <InstallExecuteSequence>
    <Custom Action='KillSuperbolt' Before='InstallValidate'/>
    <Custom Action='RemoveStartup' After ='InstallValidate'/>
    <Custom Action='LaunchInstalledExe' After='InstallFinalize'/>
  </InstallExecuteSequence>

  <Property Id="WixQuietExecCmdLine" 
      Value='"[WindowsFolder]\System32\taskkill.exe" /F /T /IM Superbolt.exe'/>

  <CustomAction Id="KillSuperbolt" 
          BinaryKey="WixCA" 
          DllEntry="WixQuietExec" 
          Execute="immediate" 
          Return="ignore"/>

  <SetProperty Id='WixQuietExecCmdLine' Before='RemoveStartup' Sequence='execute' Value='"[WindowsFolder]\System32\cmd.exe" /c del "[ProgramMenuFolder]Startup\Superbolt.lnk"'/>

  <CustomAction Id="RemoveStartup"
      BinaryKey="WixCA"
      DllEntry="WixQuietExec"
      Execute="immediate"
      Return="ignore"/>

<CustomAction Id="LaunchInstalledExe"
     FileKey="SuperboltLauncherExe"
     ExeCommand="" 
     Execute="immediate" 
     Impersonate="yes" 
     Return="asyncNoWait" />
相关问题