Add shortcut arguments in MSIX with PSF

Although not very popular, it’s not uncommon for applications to have shortcuts which pass arguments to the executable.

One popular example would be VLC Media Player. When you install VLC Media Player you get 3 shortcuts:

  • The standard VLC Media Player shortcut (which points to VLC.exe)
  • The VLC Media Player Skinned shortcut, which points to the VLC executable and has the “-Iskins” argument
  • The VLC Media Player Reset Preferences shortcut, which points to the VLC executable and has the “–reset-config –reset-plugins-cache vlc://quit” argument

Unfortunately, MSIX does not natively support shortcut arguments. When you perform a capture for VLC, only the VLC Media Player shortcut is captured, and the other two ones with arguments are ignored.

However, you can add shortcut arguments using the Package Support Framework (PSF) from Microsoft. I already covered some basics with PSF in a previous article, so please check it out.

 

So let’s see how we can solve the problem for the VLC package with PSF and Microsoft MSIX Packaging Tool.

 

1. Add PSF in the package

In the root of the package, add the following files:

  • PsfLauncher32.exe
  • PsfLauncher64.exe
  • PsfRunDll32.exe
  • PsfRunDll64.exe
  • PsfRuntime32.dll
  • PsfRuntime64.dll

The files can be downloaded from here.

 

2. Edit the manifest file

Next thing to do is to create two additional shortcuts. In the Package Information tab, scroll to the bottom and under the Manifest File click Open File.

Under the Applications element in the xml manifest file, an Application element is already present with the first shortcut. This points to “VFS/ProgramFilesX64/VideoLAN/VLC/vlc.exe”.

Above this Application element, add two new applications:

<Application Id=”VLC2″ Executable=”PsfLauncher64.exe” EntryPoint=”Windows.FullTrustApplication”>
<uap:VisualElements BackgroundColor=”transparent” DisplayName=”VLC media player skinned” Square150x150Logo=”Assets\Square150x150Logo.png” Square44x44Logo=”Assets\Square44x44Logo.png” Description=”VLC media player skinned”>
<uap:DefaultTile Wide310x150Logo=”Assets\Wide310x150Logo.png” Square310x310Logo=”Assets\Square310x310Logo.png” Square71x71Logo=”Assets\Square71x71Logo.png” />
</uap:VisualElements>
</Application>
<Application Id=”VLC3″ Executable=”PsfLauncher64.exe” EntryPoint=”Windows.FullTrustApplication”>
<uap:VisualElements BackgroundColor=”transparent” DisplayName=”VLC media player Reset Preferences” Square150x150Logo=”Assets\Square150x150Logo.png” Square44x44Logo=”Assets\Square44x44Logo.png” Description=”VLC media player Reset Preferences”>
<uap:DefaultTile Wide310x150Logo=”Assets\Wide310x150Logo.png” Square310x310Logo=”Assets\Square310x310Logo.png” Square71x71Logo=”Assets\Square71x71Logo.png” />
</uap:VisualElements>
</Application>

What we did is create two new shortcuts. The first new shortcut has the VLC2 ID and points to PsfLauncher64.exe. The second new shortcut has the VLC3 ID.

We also added different display names and descriptions, so that we know what each new shortcut does.

Regarding shortcut icons, it’s easy with VLC because all of the shortcuts have the same logo, so the same assets could be reused. For other applications, the icons must be added as assets in the Assets folder.

 

3. Create and add the config json

We are almost there. The last thing we need to do is to create a config.json file, from which the PsfLauncher reads and knows what fixes/arguments will be used before launching the VLC executable.

The config json file looks like this:

{
“applications”: [
{
“id”: “VLC3”,
“executable”: “VFS/ProgramFilesX64/VideoLAN/VLC/vlc.exe”,
“arguments” : ” –reset-config –reset-plugins-cache vlc://quit”
},
{
“id”: “VLC2”,
“executable”: “VFS/ProgramFilesX64/VideoLAN/VLC/vlc.exe”,
“arguments”: ” -Iskins”
}
]
}

We told PsfLauncher that for VLC3 (the ID for the reset preferences shortcut) to launch VLC.exe located in “VFS/ProgramFilesX64/VideoLAN/VLC/vlc.exe” with the “ –reset-config –reset-plugins-cache vlc://quit” arguments.

We do the same thing for VLC2 (the ID for the VLC Media Player Skinned shortcut) to launch VLC.exe located in the same location with the ” -lskins” arguments.

Add the config.json in the root of the package.

 

4. Voila

With all the above changes, we build the package and install it. Upon launching the VLC Media Player Skinned shortcut, the skinned interface appears.

The other shortcut resets the VLC preferences as designed.

Not that hard eh? Hope you liked this small tutorial.

Sharing is caring!

Leave a comment

Your email address will not be published. Required fields are marked *

five × 1 =