在安装结束时打开 readme.txt 在 WiX 中失败 [英] Open readme.txt at end of installatin failed in WiX
问题描述
我们想在安装结束时打开一个记事本文件.因此,我复制了一个 readme.txt 并在安装期间放置在某个本地驱动器下,然后尝试从该位置打开.但是,它给出了系统找不到指定的路径"的问题.但是,当我将本地硬编码路径指定为d:\readme.txt"时,它可以正常工作.
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.
推荐答案
WiX SDK 中有一个主题叫做 如何:在安装后运行已安装的应用程序,如果您只想这样做,它可用于启动 readme.txt
.
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.
如果您真的不想要那种用户体验,我建议您使用 WixShellExec
自定义操作来启动 readme.txt
而不是尝试启动 Notepad.exe.这样 readme.txt
将在用户的默认 .txt 编辑器中打开.你可以这样做:
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>
这篇关于在安装结束时打开 readme.txt 在 WiX 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!