On Start Menu and Shortcuts

The application Start Menu Shortcut represents the most common entry point for end-users to access applications.  In this article, I’ll talk about the old shortcuts and the new, and about what happens when we repackage applications containing shortcuts into MSIX and App-V packages.  Note that this article is written in September of 2019 and we hope that improvements in support for the MSIX case will happen in the future.

The start menu is generated by a special version of the explorer.exe process that is run when the user logs in.

The traditional shortcut is defined by a file ending in a .lnk file type extension. 

MSI and EXE installers add the start menu shortcut by adding a special file that uses a .lnk file type extension to one  of several special folder locations, most often for all users, but also for the current user, in the quick launch location, or on the all users or current user desktop.

The lnk file has several important properties that define what the shortcut looks like and how it works:

  •  Full path the a target file, which is an exe file type or a file with a type that may be processed by the shell to run a command based upon the file type.
  • Optional command line arguments
  • Optional working directory. When not specified the folder of the specified file above is used as the working directory.
  • Optional ICON for display of the shortcut.  When not specified, if the specified file is an exe,  the first image in the referenced PE file will be used, or if none a generic icon is used. When not specified and the specified file not an exe, the icon associated with the file type is used, or if none a generic icon is used.

Although it is rarely done, it is also possible to add files other than lnk files to the folder locations mentioned previously. In that case, the shell would use file type associations to display and execute the shortcut.

Prior to Windows 8, the start menu was generated from just these lnk (and other)  files from these standard locations. Starting with Windows 8, files in these locations are referenced, along with newer style shortcuts added by “modern” application formats, and ultimately gathered into a single new file for the user session and displayed by the session explorer process.

The modern shortcut is defined as a shortcut element of the AppXManifest.xml file of the package installer.

This new style shortcut is used in App-V, AppX, and MSIX packages. Currently, the syntax and capabilities of the new shortcut is different depending on the package format. During installation of one of these packages, the shortcut element of the AppXManifest file is combined with the current start menu.

The App-V form of this modern shortcut includes all of the capabilities described previously for the traditional shortcut lnk files, with the exception of targets that point to non-exe files.  For those shortcuts, manual manipulation of the shortcut to remove the file association is necessary during repackaging. For example, it the target was a cmd file, making the target become cmd.exe and arguments “/c path-to-cmdfile”

The AppX and MSIX form of this modern shortcut (referred to as an entry point) currently only supports the target field. We expect/hope other fields will eventually be supported, but the following restrictions currently exist:

  • There are no command line arguments
  • There is no specification of a working directory. Furthermore, unlike the lnk file where the working directory will be the folder of the target exe by default, under AppX amd MSIX the Windows System32 folder is the working directory.
  • There is no specification of the Icon. The target exe will be examined, and if an ICON is present it will be used.  
  • Additionally, non-exe targets are not supported, however without arguments you can’t work around them like we do for App-V.

Using the Package Support Framework (PSF) and adding it to the MSIX package during repackaging allows replacement of the target with a PSF based launcher program that can then include support for configuring the real target executable, command line arguments, and working directory in a json file stored in the package.  As the icon cannot be specified in the entry point, this means that (at this time) the start menu entry for this program will be the icon of the launcher program (which usually doesn’t have an icon in it resulting in a generic icon being displayed).

By Tim Mangan

Tim is a Microsoft MVP, and a Citrix CTP Fellow. He is an expert in App-V and MSIX.