如何为所有用户安装程序快捷方式? [英] How to install program shortcuts for all users?
问题描述
我正在使用 Windows Installer XML 工具包创建安装程序 msi 文件.安装创建的 msi 文件时,放置在 ProgramMenuFolder 文件夹下的快捷方式会生成仅适用于管理员用户的快捷方式.如何让安装程序在所有用户"配置文件下创建快捷方式,以便机器上的每个人都拥有该快捷方式?
I'm creating an installer msi file using the Windows Installer XML toolkit. When installing the created msi file, a shortcut placed under the ProgramMenuFolder folder results in a shortcut for the Administrator user only. How do I let the installer create a shortcut under the All Users profile, so that everyone on the machine has the shortcut?
推荐答案
Stuart Preston 的博客很好地描述了如何做到这一点:
Stuart Preston's blog has a good description of how to do this:
为所有用户"安装快捷方式(通过 Wayback Machine)
概要是:
在您的 .wxs 文件中,包括以下内容:
In your .wxs file, include the following:
<Property Id="ALLUSERS"><![CDATA[2]]></Property>
这将预设一个模仿选择行为的属性为您的安装选择所有用户"而不是只有我".你会也需要类似如下的目录结构:
This will preset a property which mimics the behaviour of selecting the "All Users" rather than "Just Me" for your installation. You'll need a directory structure similar to the following too:
<Directory Id='ProgramMenuFolder' Name='PMenu' LongName='Programs'>
<Directory Id='MyProductShortcutDir' Name='MyPMenu' LongName='MyProduct' />
</Directory>
最后,您的快捷方式应该在文件"元素内,如下所示:
Finally, your shortcut should be within a "File" element, as follows:
<File Id="MyProduct.File0" LongName="MyProduct.exe" Name="MYPROD_1.EXE" src="c:\MyProductSourceFolder\MyProduct.exe" >
<Shortcut Id="MyProduct.Shortcut" Directory="MyProductShortcutDir" Name="MPSCUT" LongName="My Product Shortcut" />
</File>
这篇关于如何为所有用户安装程序快捷方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!