How to Start a Universal Windows App (UWP) from PowerShell in Windows 10? How to Start a Universal Windows App (UWP) from PowerShell in Windows 10? powershell powershell

How to Start a Universal Windows App (UWP) from PowerShell in Windows 10?


During development, I've encountered a situation where the app family name occasionally changed. You can reliably launch an app by name with a simple lookup:

  • Cmd

    powershell.exe explorer.exe shell:AppsFolder\$(get-appxpackage -name YourAppName ^| select -expandproperty PackageFamilyName)!App
  • Powershell

    explorer.exe shell:AppsFolder\$(get-appxpackage -name YourAppName | select -expandproperty PackageFamilyName)!App


With the Windows 10 Fall Creators Update 1709 (build 16299) you now have the ability to define an app execution alias for your UWP app, so you can launch it easily from cmd or powershell:

<Extensions>    <uap5:Extension      Category="windows.appExecutionAlias"      StartPage="index.html">      <uap5:AppExecutionAlias>        <uap5:ExecutionAlias Alias="MyApp.exe" />      </uap5:AppExecutionAlias>    </uap5:Extension></Extensions>

Furthermore, we now support commandline arguments for UWP apps. You can read them from the OnActivated event:

async protected override void OnActivated(IActivatedEventArgs args){    switch (args.Kind)    {        case ActivationKind.CommandLineLaunch:            CommandLineActivatedEventArgs cmdLineArgs =                 args as CommandLineActivatedEventArgs;            CommandLineActivationOperation operation = cmdLineArgs.Operation;            string cmdLineString = operation.Arguments;            string activationPath = operation.CurrentDirectoryPath;

See blog post:https://blogs.windows.com/buildingapps/2017/07/05/command-line-activation-universal-windows-apps/


Try this in PowerShell:

start shell:AppsFolder\TonyHenrique.tonyuwpteste_h3h3tmhvy8gfc!App