Reputation: 699
I am looking for a way to launch/run windows store apps on windows 10/8.1 from C#.
Examples of the apps I am trying to run are
Note: in Windows 10 these are no longer standard .exe files that can be executed by double clicking or calling Process.Start() as they are now windows store apps.
I have tried to use IApplicationActivationManager but I cannot find decent documentation with examples of how to use it.
Upvotes: 12
Views: 6236
Reputation: 111
I'd like to offer another option. If you run in Powershell the following command:
(New-Object -Com Shell.Application).NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}").Items() | sort Name | ft Name,Path
or
get-StartApps | sort Name
You get pretty much the same output. However, the 1st command is a bit more useful. It has a clear delimiter - the colon : , whereas the 2nd command (the one marked as the answer) does not. Might be useful in certain situations where you need to separate the PackageFamilyName from the App_ID using the split() command.
Upvotes: 0
Reputation: 1985
I found a cool way to run every Windows Universal apps which downloaded via Windows Store or preinstalled.
Each Windows 10 Universal app has an AUMID
which stands for 'Application User Model ID'.
PowerShell Command to get all AUMID:
get-StartApps
Output:
PS C:\> get-StartApps Name AppID ---- ----- Skype Microsoft.SkypeApp_kzf8qxf38zg5c!App Snip & Sketch Microsoft.ScreenSketch_8wekyb3d8bbwe!App Mail microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w... Calendar microsoft.windowscommunicationsapps_8wekyb3d8bbwe!microsoft.w... Movies & TV Microsoft.ZuneVideo_8wekyb3d8bbwe!Microsoft.ZuneVideo OneNote for Windows 10 Microsoft.Office.OneNote_8wekyb3d8bbwe!microsoft.onenoteim Photos Microsoft.Windows.Photos_8wekyb3d8bbwe!App Video Editor Microsoft.Windows.Photos_8wekyb3d8bbwe!SecondaryEntry Maps Microsoft.WindowsMaps_8wekyb3d8bbwe!App Alarms & Clock Microsoft.WindowsAlarms_8wekyb3d8bbwe!App Voice Recorder Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App Feedback Hub Microsoft.WindowsFeedbackHub_8wekyb3d8bbwe!App Xbox Game Bar Microsoft.XboxGamingOverlay_8wekyb3d8bbwe!App Camera Microsoft.WindowsCamera_8wekyb3d8bbwe!App Microsoft Store Microsoft.WindowsStore_8wekyb3d8bbwe!App Weather Microsoft.BingWeather_8wekyb3d8bbwe!App Cortana Microsoft.549981C3F5F10_8wekyb3d8bbwe!App Instagram Facebook.InstagramBeta_8xx8rvfyw5nnt!Instagram ...
So now, you can start any universal app via its AUMID like this:
explorer shell:appsfolder\[AUMID]
For example, if you want to execute Skype
:
explorer shell:appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App
Now it's the time to back to Csharp:
Process.Start("explorer shell:appsfolder\Microsoft.BingWeather_8wekyb3d8bbwe!App");
The Windows Weather
App will execute.
Upvotes: 11
Reputation: 157098
There are several ways to do it. The easiest way is to use Process.Start
and the URL or file handlers.
For example this will open the Video app:
Process.Start("microsoftvideo://");
Or the Store on the updates page:
Process.Start("ms-windows-store:updates");
Or the Photos app:
Process.Start("ms-photos://");
There are several more handles, some of them can you find here. You can find the names when you open the registry key HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId
. Look for the CustomProperties
key. It has an attribute Name
. That is the one to use.
Some other useful pointer can be found on SU: How do I run a Metro-Application from the command-line in Windows 8?.
Upvotes: 9