0
votes

I have a custom action in my WiX script to copy installation log:

<CustomAction Id="CopyLogFile" Execute="immediate"
            ExeCommand="cmd /c copy [MsiLogFileLocation] &quot;\&quot;[APPLICATIONFOLDER]Install.log\&quot;&quot;"
            Directory="TARGETDIR"
            Impersonate="no"
            Return="asyncNoWait" />
    <InstallExecuteSequence>
      <Custom Action="CopyLogFile" OnExit="success" />
    </InstallExecuteSequence>

The problem is the APPLICATIONFOLDER environment variable. No matter how I try to use it it does not work. I tried single &quot, double &quot, no &quot, etc. Nothing helps.

If I hard-code the destination like this:

ExeCommand="cmd /c copy [MsiLogFileLocation] c:\temp\Install.log"

it works fine.

However, I need to copy the install log to some known location on the user's machine.

I looked at WiX CustomAction ExeCommand failing?, and Not able to send Wix SourceDir path with spaces to custom action ExeCommand but it does not help with this issue.

1

1 Answers

0
votes

According to Windows Installer Formatted reference your commandline should be:

cmd /c copy [MsiLogFileLocation] &quot;\&quot;[%APPLICATIONFOLDER]Install.log\&quot;&quot;
                                               ^

You are missing the % prefix for environment variables.