Running UWP applications from the command line with "arguments"
UWP (Universal Windows Platform) applications are designed to run on multiple Windows devices, including PCs, tablets, Xbox consoles, and HoloLens. While most UWP apps are launched using the graphical interface, it is also possible to run them from the command line with additional arguments. This can be useful for troubleshooting, automation, or advanced usage scenarios.
To run a UWP application from the command line, you'll need to know its unique application identifier (AppUserModelId). This identifier is a combination of the app's package family name and the app's package relative application identifier.
Here's how you can find the AppUserModelId for a UWP application:
- Open PowerShell or Command Prompt.
- Type
Get-AppxPackageand press Enter. - Scroll through the list of installed packages and locate the UWP application you want to run.
- Note down the value of the
PackageFamilyNameproperty for the app.
Now that you have the AppUserModelId, you can use it to run the UWP application from the command line.
Open PowerShell or Command Prompt and type the following command:
start shell:AppsFolder\<AppUserModelId>!<PackageRelativeAppId>
Replace <AppUserModelId> with the actual AppUserModelId you noted down earlier, and replace <PackageRelativeAppId> with the package relative application identifier of the app.
For example, if the AppUserModelId is Microsoft.ZuneMusic_8wekyb3d8bbwe!Microsoft.ZuneMusic, the command would look like this:
start shell:AppsFolder\Microsoft.ZuneMusic_8wekyb3d8bbwe!Microsoft.ZuneMusic
Press Enter to run the command. The UWP application should now launch.
If you want to pass additional arguments to the UWP application, you can do so by appending them to the command. For example, to open the UWP application with a specific file, you can use the following command:
start shell:AppsFolder\<AppUserModelId>!<PackageRelativeAppId> "C:\path\to\file"
Replace "C:\path\to\file" with the actual path to the file you want to open with the UWP application.
Running UWP applications from the command line with arguments can be a powerful tool for advanced users. It allows for automation, batch processing, and troubleshooting scenarios that go beyond the regular graphical interface. However, it's important to note that not all UWP applications support command line arguments, so not all apps will respond to these commands.
References:
| Reference | Link |
|---|---|
| Microsoft Docs - Universal Windows Platform (UWP) | https://docs.microsoft.com/en-us/windows/uwp/ |
| Microsoft Docs - Get-AppxPackage | https://docs.microsoft.com/en-us/powershell/module/appx/get-appxpackage |