Search code examples
batch-filecommand-linewixcustom-action

Launch bat with CustomAction


I have my wix file (.wxs) with my CustomAction :

...
<CustomAction Id="shellex" Directory="WINDOWSVOLUME" Impersonate="no" ExeCommand="cmd.exe /k &quot;C:\rep\file\script.bat&quot; " Return="asyncNoWait" />
<InstallExecuteSequence>
<Custom Action="shellex" After="InstallFiles" />
</InstallExecuteSequence>
...

But when i execute my wixinstaller, it's all good except the CustomAction with cmd.exe that opens and informs that "The specified path was not found" but the path is correct. I don't understand why batch file was not found.

ADD Detail : My .bat was deployed with the installer.

Anyone have a solution ?

Edit 1 : I tried ExeCommand="cmd.exe /k cd rep " And i have "The specified path was not found"

Edit 2 : I tried ExeCommand="cmd.exe /k dir /s A:D >out.txt " And i see that folder /rep/ doesn't exists at the .bat execution. /rep/ was created with installer.

The property After="InstallFiles" doesn't works ?


Solution

  • Finally I found the solution.

    The solution was to change After="InstallFiles" to After="InstallFinalize" .

    With "InstallFinalize" the CustomAction is executed at the very ending of installation. Before the "shell" couldn't find the batch file because he had not yet been deployed.