Open readme.txt at end of installatin failed in Wi

2019-07-07 01:27发布

问题:

We would like to open a notepad file at end of the installation. Hence I copied a readme.txt and placed under some local drive during installation then tried to open from that location. But, it is giving "The system cannot find the path specified" issue. However, it was working when I gave the local hard coded path as like "d:\readme.txt".

<Directory Id='ProgramFilesFolder' Name='PFiles'>
   <Directory Id='INSTALLDIR' Name='SimpleMvvmToolkit_2012'>          
   </Directory>
</Directory>


<Property Id='NOTEPAD'>Notepad.exe</Property>
<CustomAction Id='LaunchFile' Property='NOTEPAD' ExeCommand='[INSTALLDIR]Readme.txt'
              Return='asyncNoWait' />

<InstallExecuteSequence>
   <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>

Somewhere I did mistake but I couldn't find out exactly.

回答1:

There is a topic in the WiX SDK called How To: Run the Installed Application After Setup that could be used to launch the readme.txt if you just wanted to do that.

If you really don't want that user experience, I would recommend using the WixShellExec custom action to launch the readme.txt instead of trying to launch Notepad.exe. That way the readme.txt will open in the user's default .txt editor. You can do that by:

<Property Id="WixShellExecTarget" Value="[#FileIdForReadMe.txt]" />
<CustomAction Id="LaunchFile" 
    BinaryKey="WixCA" 
    DllEntry="WixShellExec"
    Impersonate="yes" />

<InstallExecuteSequence>
   <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>


标签: wix wix3.6