我需要帮助将XML添加到开始菜单中的All Programs folder
,如上图所示。我已经编写了添加到桌面的xml,但似乎找不到开始菜单的那个。
This is the xml I used to add to desktop but I also want one for the All Programs Folder
<DirectoryRef Id="DesktopFolder">
<Component Id="DesktopShortcut"
Guid="{SOME-GUID}">
<Shortcut Id="StartMenuShortcut"
Name="!(bind.property.ProductName)"
Target="[#MyApp]"
WorkingDirectory="APPLICATIONROOTDIRECTORY"
Icon="Icon.ico" />
<RemoveFolder Id="CleanUpShortCut"
Directory="DesktopFolder"
On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\[ProductName]" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
答案 0 :(得分:3)
例如,您可以通过添加以下通用目录标记来完成此操作:
<Directory Id="TARGETDIR" Name="SourceDir"> <!--Mandatory base <directory> declaration.-->
<!--Specify the Program Menu Folder directory and Desktop folder for shortcuts-->
<Directory Id="ProgramMenuFolder" Name="All Programs folder"> <!--%ProgramData%\Microsoft\Windows\Start Menu\Programs\-->
<Directory Id ="YourCompanyFolder1" Name="Your Company"> <!--%ProgramData%\Microsoft\Windows\Start Menu\Programs\Your Company\-->
<Directory Id ="YourCompanySubFolder1" Name="Sub Folder1"> <!--%ProgramData%\Microsoft\Windows\Start Menu\Programs\Your Company\Sub Folder1\-->
<Directory Id="YourAppFolder1" Name="YourAppFolder1"/> <!--%ProgramData%\Microsoft\Windows\Start Menu\Programs\Your Company\Sub Folder1\YourAppFolder1\-->
</Directory>
</Directory>
</Directory>
</Directory>
然后,您可以使用“YourAppFolder1”作为应用程序快捷方式的目录引用。这样做的示例代码如下:
<!--StartMenu Shortcut for YourApp-->
<DirectoryRef Id="YourAppFolder1">
<Component Id="ApplicationStartMenuShortcut" Guid="USEYOUROWNGUID">
<Shortcut Id="YourAppStartMenuShortcut"
Name="YourApp"
Description="YourApp description"
Target="[INSTALLFOLDER]\YourApp.exe"
WorkingDirectory="YourApp">
<Icon Id="Icon" SourceFile="..\YourApp\Images\YourApp.ico"></Icon>
</Shortcut>
<RemoveFolder Id="RemoveYourCompanyFolder1" Directory="YourCompanyFolder1" On="uninstall" />
<RemoveFolder Id="RemoveCompanySubFolder1" Directory="YourCompanySubFolder1" On="uninstall" />
<RemoveFolder Id="RemoveYourAppFolder1" Directory="YourAppFolder1" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\YourApp" Name="installed" Type="integer" Value="1" KeyPath="yes" />
</Component>
</DirectoryRef>
答案 1 :(得分:1)
@Tushortz here您可以找到将已安装的程序添加到“所有程序”文件夹(即Windows“开始”菜单)的步骤,以及完整的示例。