There's helpful information in the existing answers, but let me try to bring it all together, along with automated steps.
This answer assumes the existence of an application-specific URI protocol. If that is not true for a given application, invoke it via the shell:
URI scheme as shown in the accepted answer (passing such a URI directly to Start-Process
is sufficient; e.g.,
Start-Process shell:AppsFolder\Microsoft.WindowsAlarms_8wekyb3d8bbwe!App
). Note that you need to know the application family name, which includes the abstract publisher ID (8wekyb3d8bbwe
);
Get-AppXPackage
can help with the discovery - see below.
Windows 8+ Metro-style apps (obsolete term) a.k.a UWP applications / AppX packages / Microsoft Store applications are best launched by URLs using an application-specific protocol scheme:
For instance, the Calculator Windows 10 application defines two URL protocol names, calculator
and ms-calculator
, both of which can be used with a trailing :
with Start-Process
:
# Note the trailing ":"
Start-Process calculator: # Or: Start-Process ms-calculator:
Microsoft Edge supports protocol microsoft-edge
, among others, so you can open a given URL, say http://example.org
in Edge as follows:
Start-Process microsoft-edge:http://example.org
Note how in this case the :
after the protocol name is followed by an argument to pass to the target application.
Caveat: As of PowerShell (Core) 7.2, many AppX applications cannot be launched with the -Wait
and -PassThru
parameters - see GitHub issue #10996.
The challenge is how to discover a given application's protocol names by its application name (package name).
The following section discusses where this information can be found in the registry, and defines custom helper function GetAppXUriProtocol
(source code below), which automates this discovery, allowing you to target applications by wildcard expressions, if the exact package name isn't known (which is typical).
For instance, you can find the protocol names for the Calculator application as follows:
# Find the protocol names supported by the Calculator application,
# by wildcard expression rather than full package name.
PS> Get-AppXUriProtocol *calculator*
PackageFullName Protocols
--------------- ---------
Microsoft.WindowsCalculator_10.1908.0.0_x64__8wekyb3d8bbwe {calculator, ms-calculator}
That is, you can use Start-Process calculator:
or Start-Process ms-calculator:
to start the Calculator application.
If you just want information about an AppX package - which does not include the protocol names - use the standard Get-AppXPackage
cmdlet; e.g.:
PS> Get-AppXPackage *calculator*
Name : Microsoft.WindowsCalculator
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
...
Discovering an AppX application's URL protocol names:
The HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId
registry location has subkeys named for installed AppX packages, which specify the URL protocol names they support in the Name
values of ActivatableClassId\*\CustomProperties
subkeys.
The following function, Get-AppXUriProtocol
, retrieves the protocol names associated with a given AppX application via the Get-AppXPackage
cmdlet and registry lookups.
The function supports wildcard expressions, so you can search by part of a package name, such as an application's common name; e.g.
Get-AppXUriProtocol *calc*
Get-AppXUriProtocol
source code:
function Get-AppXUriProtocol {
<#
.SYNOPSIS
Gets the URI protocol names assocated with AppX packages on Windows 8 and above.
.DESCRIPTION
Given AppX package names or wildcard expressions, retrieves all associated
URI protocol names that can be used to launch these applications.
AppX is the package format for UWP applications typically distributed via
the Microsoft Store.
For instance, the protocol names associated with the Windows 10 Calculator
application are 'calculator' and 'ms-calculator', so you can use
Start-Process calculator: (note the appended ":") to launch it.
.PARAMETER PackageName
One or more package family names, full package names, or wildcard expresssions
matching either.
.EXAMPLE
Get-AppXUriProtocol *calculator*
Outputs a [pscustomobject] instance such as the following:
PackageFullName Protocols
--------------- ---------
Microsoft.WindowsCalculator_10.1908.0.0_x64__8wekyb3d8bbwe {calculator, ms-calculator}
#>
[CmdletBinding(PositionalBinding = $false)]
[OutputType([pscustomobject])]
param (
[Parameter(Mandatory, Position = 0)]
[SupportsWildcards()]
[string[]] $PackageName
)
begin {
if ($env:OS -ne 'Windows_NT') { Throw "This command is supported on Windows only." }
}
process {
# !! Even though Get-AppXPackage allegedly accepts -Name values from the pipeline
# !! that doesn't work in practice.
$packages = foreach ($name in $PackageName) { Get-AppXPackage -Name $name }
foreach ($package in $packages) {
$protocolSchemes = (Get-ChildItem registry::HKEY_CLASSES_ROOT\Extensions\ContractId\Windows.Protocol\PackageId\$($package.PackageFullName)\ActivatableClassId\*\CustomProperties).ForEach('GetValue', 'Name')
[pscustomobject] @{
PackageFullName = $package.PackageFullName
Protocols = $protocolSchemes
}
}
}
}