简体   繁体   English

使用 wix 安装程序执行命令

[英]execute commands using wix installer

In my Product.wsx I called one bat file which is executed using power shell. Batch file is uninstalling one.exe(differet app) and coping few folders in C:\temp folder.在我的 Product.wsx 中,我调用了一个使用 power shell 执行的 bat 文件。批处理文件正在卸载 one.exe(differet app)并处理 C:\temp 文件夹中的几个文件夹。

In web may placess I read calling BAT file from WIX is not good or advisable.在 web 可能我读到从 WIX 调用 BAT 文件的地方不好或不可取。 IS there any other way to do the same without calling the bat file有没有其他方法可以在不调用 bat 文件的情况下做同样的事情

        <SetProperty Id="InvokeTestPS1"
                     Before="InvokeTestPS1"
                     Sequence="execute"
                     Value ="&quot;[POWERSHELLEXE]&quot; -Version 2.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command &quot;&amp; '[APPLICATIONROOTDIRECTORY]Upgrade\upgradeMentor3_5.bat' ; exit $$($Error.Count)&quot;" />
        <CustomAction Id="InvokeTestPS1"
                      BinaryKey="WixCA"
                      DllEntry="CAQuietExec64"
                      Execute="deferred"
                      Return="check"
              Impersonate="no" />
        <InstallExecuteSequence>
          <Custom Action="InvokeTestPS1" After="InstallFiles">
            <![CDATA[NOT Installed]]>
          </Custom>

For the folders you are copying, if you know beforehand what each folder is named and you don't need to worry about unexpected subfolders, you can use a CopyFile per folder you want to copy.对于您正在复制的文件夹,如果您事先知道每个文件夹的名称并且您不需要担心意外的子文件夹,您可以为每个要复制的文件夹使用一个CopyFile Place them directly under a Component .将它们直接放在Component下。 If there's more variability in what needs to be copied, you can write an immediate custom action that adds temporary rows to the MoveFile table based on the files/folders you discover you need to copy (and the sane to the Directory table as needed).如果需要复制的内容有更多可变性,您可以编写一个即时自定义操作,根据您发现需要复制的文件/文件夹(以及根据需要向Directory表添加临时行)将临时行添加到MoveFile表中。

For the uninstaller, you could call it instead of either powershell or the .bat file.对于卸载程序,您可以调用它而不是powershell.bat文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM