MSIX doesn’t natively support shortcut ‘Start In’ working directories, that you would typically see when viewing the properties of an lnk shortcut. This blog explains how we can use the Package Support Framework (PSF) to add an MSIX Shortcut Working Directory/Start In location.
MSIX Shortcut Working Directory/Start In
Sometimes when we launch an application, the shortcut ‘Start In’ location tells the executable where to look for certain files and configurations at runtime. If this value isn’t present (as is the case in MSIX shortcuts) the application will likely throw errors.
To remediate this we can use the Package Support Framework (PSF) to set a working directory/start in location at runtime.
The principle is almost identical to when we added MSIX shortcut arguments/parameters. So in the main you should follow that blog.
The only difference is the contents of the config.json file. Using the previous example linked to above, the original config.json file to provide MSIX shortcut arguments/parameters was:
{
"applications": [
{
"id": "ALKANEAPP",
"executable": "VFS\\ProgramFilesX86\\Alkane\\Alkane.exe",
"arguments": "-alkaneargument"
}]
}
We can amend this to become:
{
"applications": [
{
"id": "ALKANEAPP",
"executable": "VFS\\ProgramFilesX86\\Alkane\\Alkane.exe",
"arguments": "-alkaneargument",
"workingDirectory": "VFS\\ProgramFilesX86\\Alkane\\"
}]
}
You will note the addition of the ‘workingDirectory’ value which points to the directory where Alkane.exe resides. It really is that simple.
Thanks for this! Really helpful, but now I have an app which uses variables in the arguments and working dir.
Arguments contain: %appdata% and %temp%
Working dir contains: %homedrive%
Any idea how to translate this to json?
Hi. I *think* you should just be able to include % in the relevant strings? What have you tried, and what is happening?