wix, install files and run bat file

2019-02-25 22:42发布

I have problem using wix to build msi installer which will install some bat file and run it. I found some example on the internet, but i was not able to make it work :/ here is my wix source file

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="44A8F987-6B89-422B-B41F-1364AE1EF0D5" Name="my_name" Language="1033" Version="1.11.5164" Manufacturer="company" UpgradeCode="BD8652F4-1C1A-4825-9799-7DFB499B9F12">
        <Package Description="Test file in a Product" Comments="Simple test" InstallerVersion="200" Compressed="yes" />
        <Media Id="1" Cabinet="simple.cab" EmbedCab="yes" />
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Name="my_folder" Id="MY_FOLDER">
                  <Component Id="CONFIGURE.BAT" DiskId="1" Guid="041ED78B-3D42-4EBD-8DAE-29D94DEFFC20">
                         <File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="C:\Documents and Settings\root\Desktop\some_path\configure.bat" />
                  </Component>  
                </Directory>
            </Directory>
        </Directory>
        <Feature Id="MainFeature" Title="Main Feature" Level="1">
                   <ComponentRef Id="CONFIGURE.BAT" />
        </Feature>
        <UI />
        <UIRef Id="WixUI_Minimal" />

        <CustomAction Id="BatchCmd" Property="BatchRun" Value="&quot;[#file_configure.bat]&quot;" Execute="immediate">
        </CustomAction>
        <CustomAction Id="BatchRun" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="yes">
        </CustomAction>
        <InstallExecuteSequence>
            <Custom Action="BatchCmd" Before="BatchRun">NOT Installed</Custom>
            <Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
        </InstallExecuteSequence>  
    </Product>
</Wix>

Configure.bat file is installed correctly, but it won't run during install. Plz help

标签: wix
0条回答
登录 后发表回答