How to Open a Windows Modern UWP App From the Command Line

I've been using SlickRun as the launcher for all my scripts and shortcuts for many years. I love it, and I recommend chipping in a few bucks to the developer to keep it going if you love it, too. But there's one thing that has eluded me: opening Windows modern apps from SlickRun. Since I don't use modern apps often, this has never been a big concern. Years ago, I looked into launching modern apps from the command line, and I was put off by the absurd complexity. This is a good example of Microsoft abandoning its command-line users, giving us no convenient way to do something that we consider absolutely essential to the operating system. Last week, however, I discovered that pulling all my work-related Google calendars into Windows Calendar gives me a fast way to see my events in a unified desktop app, with reliable event notifications. Now that I'm finally using a modern app on a daily basis, I wanted a way to launch it from SlickRun and to add it to my morning work-startup .bat script.

This post was the key to my understanding what's involved. But, using SlickRun, I was able to simplify the process somewhat -- although it's still absurdly complicated. Farther down, I also provide steps you can use to build the explorer.exe shell command using Task Manager instead of SlickRun to find the directory that contains the modern app executable.

Steps to Add a Windows "Modern" UWP App to SlickRun
You will need to collect three pieces of information for the Universal app you want to launch
  • Package Name
  • Publisher ID
  • Application ID

SlickRun can help you collect this information. (Dear Microsoft: why isn't this info available on the Microsoft Store listing for the app, or in Task Manager, or on the app's listing in Settings -> Apps & features?)

1. Open the modern app as you normally would, from the Start menu, task bar, etc.
2. Open SlickRun and type "add" to create a new "magic word"
3. Drag-and-drop the eye-dropper from the "Customize SlickRun" dialog onto the modern app; this will populate the "Filename or URL" field with a value that looks like this:
C:\Program Files\WindowsApps\microsoft.windowscommunicationsapps_16005.12827.20560.0_x64__8wekyb3d8bbwe\HxCalendarAppImm.exe
The name of the directory in which the .exe file is stored gives you two of the three pieces of information you'll need... but you have to know how to parse it. The name, "microsoft.windowscommunicationsapps_16005.12827.20560.0_x64__8wekyb3d8bbwe", starts with the Package Name ("microsoft.windowscommunicationsapps"), is followed by version and platform information that you don't need for this ("16005.12827.20560.0_x64"), and then comes the Publisher ID ("8wekyb3d8bbwe").

4. Copy the entire path
5. Type Win+R to open the Run dialog
6. Paste the path you copied, then remove the .exe file part, which will give you the path to the directory in which the .exe resides, like this:
C:\Program Files\WindowsApps\microsoft.windowscommunicationsapps_16005.12827.20560.0_x64__8wekyb3d8bbwe\
7. Click "OK" or hit to run the command; this will open the directory where the .exe file is stored
8. Open the AppxManifest.xml file in that directory (or in a parent directory... sometimes the executable is in a child directory called something like "app")
9. Near the top of the AppxManifest.xml file, you'll find an Identity element, with a Name attribute -- note that this value matches the package name, which we already got from the directory name
10. Search the AppxManifest.xml file for the executable name, e.g., HxCalenderAppImm.exe, and you'll find an XML element that looks like this:
<Application Id="microsoft.windowslive.calendar" Executable="HxCalendarAppImm.exe" EntryPoint="Executable">
This gives you the third piece of information you need: the Application ID.

Now that we've collected the three pieces of information we need, we can build the magic word.
11. In your SlickRun add-magic-word dialog, enter "explorer.exe" in the "Filename or URL" field
12. In the "Parameters" field, type the shell command, replacing the portions with the three pieces of information collected above:
shell:AppsFolder\<Package Name>_<Publisher ID>!<App ID>
Continuing with the example of the Calendar app from the Mail and Calendar package, you would enter something like this:
shell:AppsFolder\microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.calendar


How Can I Pass Command-Line Arguments to the Modern App?
The best way I've found to pass parameters to the executable is to use the Windows start command. So, for example, suppose I want to launch Windows Terminal from the command line and have it open a specific profile, instead of the default profile. From a cmd prompt, I can do this:

start "" shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App new-tab -p "GitBash"

In order to use the Windows start command from SlickRun, I use "cmd /c". So, the command above would look like this in SlickRun:
Filename or URL: cmd
Parameters: /c start "" shell:AppsFolder\Microsoft.WindowsTerminal_8wekyb3d8bbwe!App new-tab -p "GitBash"


What If I Don't Want to Use SlickRun?
For those who just want to run a Windows modern app from the command line, without needing to use SlickRun or PowerShell, you can also use Task Manager to find the information you need. The basic idea is the same; you're going to end up running a command like this:
explorer.exe shell:AppsFolder\<Package Name>_<Publisher ID>!<App ID>

Steps to determine the Package Name, Publisher ID, and App ID using Windows Task Manager:
1. Open the modern app as you normally would, from the Start menu, task bar, etc.
2. Launch Task Manager (I right-click on the Windows task bar and choose "Task Manager")
3. Expand the listing for the app you're interested in, right-click on the child item, and choose "Go to Details"
4. Right-click on the highlighted executable and choose "Open file location"
5. The name of the directory you just opened gives you the Package Name and the Publisher ID, if you know how to parse them out. Using the Calendar app as an example, the directory name, "microsoft.windowscommunicationsapps_16005.12827.20560.0_x64__8wekyb3d8bbwe", starts with the Package Name ("microsoft.windowscommunicationsapps"), is followed by version and platform information that you don't need for this ("16005.12827.20560.0_x64"), and then comes the Publisher ID ("8wekyb3d8bbwe"). Note the Package Name and Publisher ID for later use.
6. Open the AppxManifest.xml file in that directory
7. Near the top of the AppxManifest.xml file, you'll find an Identity element, with a Name attribute -- note that this value matches the package name, which we already got from the directory name
8. Search the AppxManifest.xml file for the executable name, e.g., HxCalenderAppImm.exe, and you'll find an XML element that looks like this:
<Application Id="microsoft.windowslive.calendar" Executable="HxCalendarAppImm.exe" EntryPoint="Executable">
This gives you the third piece of information you need: the Application ID.

Now that we've collected the three pieces of information we need, we can build the command to open the app from the command line.
9. Your command will look like this, replacing the portions with the three pieces of information collected above:
explorer.exe shell:AppsFolder\<Package Name>_<Publisher ID>!<App ID>
Continuing with the example of the Calendar app from the Mail and Calendar package, you would enter something like this:
explorer.exe shell:AppsFolder\microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.windowslive.calendar


If you found this helpful, you'd like to thank me, and you enjoy reading -- or know someone who does -- buy one of my books!



comments powered by Disqus