Currently I have failed to pass parameters from CAQuiteExec to cmd.exe batch. (Inspired by wix, install files and run bat file)
In deferred sequence, the installer can call commandline command "copy" and "echo" but parameter %1 is always blank...
I want to pass a Value="HAHIHUHEHO" of Property "BATCHPARAMETER" to the configure.bat. But ECHO returns its own status "ON" (same as only ECHO without any input parameter....)
Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="MY-UID" Name="my_name" Language="1033" Version="1.11.5164" Manufacturer="company" UpgradeCode="MY-UID">
<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="MY-UID">
<File KeyPath="yes" Id="file_configure.bat" Name="configure.bat" Source="configure.bat" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="Main Feature" Level="1">
<ComponentRef Id="CONFIGURE.BAT" />
</Feature>
<UI />
<UIRef Id="WixUI_Minimal" />
<Property Id="BATCHPARAMETER" Value="HAHIHUHEHO" Secure="yes" />
<CustomAction Id="SetCustomActionData" Return="check" Property="BatchCmd" Value="[BATCHPARAMETER]" />
<CustomAction Id="BatchCmd" Property="BatchRun" Value=""[#file_configure.bat]"" Execute="immediate">
</CustomAction>
<CustomAction Id="BatchRun" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="yes">
</CustomAction>
<InstallExecuteSequence>
<Custom Action="SetCustomActionData" Before="BatchCmd"></Custom>
<Custom Action="BatchCmd" Before="BatchRun">NOT Installed</Custom>
<Custom Action="BatchRun" After="InstallFiles">NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
</Wix>
configure.bat content is below: It copies the hoge.txt to a hoge{%date% without slash}.txt and writes %1 parameter inside.
setlocal
echo on
copy /Y C:\temp\hoge\hoge.txt C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt
echo %1 > C:\temp\hoge\hoge%date:~-10,4%%date:~-5,2%%date:~-2,2%.txt 2>&1
echo off
endlocal
exit /B 0