Search code examples
uwpwin-universal-appargs

winappdeploycmd launch universal windows app


I need to launch my Universal windows phone with arguments. Like android has the extra and bundle issues,so I need to know what parameter passes when the application launches. I launch it with AppDeployCmd with this command and it launches perfectly:

"C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe" /launch 739e1fa5-2fa4-4ea6-a66e-b1674c6eccfa /targetdevice:0 /

But how can I pass args to the application?Is it possible?


Solution

  • Using AppDeployCmd.exe can't pass parameters to the application. As you can see in Deploy Windows Phone 8.1 apps with the Application Deployment tool:

    AppDeployCmd.exe has the following syntax:

    AppDeployCmd.exe <cmd[:param]> <product-id/app filename> <targetdevice[:param]>

    parameter is not support in the command. And AppDeployCmd.exe is more used to deploy an app instead of launching it.

    If you want to pass parameters to an application, you can try with Launch the default app for a URI. Launcher class has a Launcher.LaunchUriAsync(Uri, LauncherOptions, ValueSet) method. You can ues this method to pass args. Or if your parameter is very simple such as just a string, then you can put this string in the URI, like in the official Association launching sample using alsdkcs://hello.

    To receive the parameters, you can refer to Handle URI activation and use ProtocolActivatedEventArgs class to get the parameters. Also you can refer to the Association launching sample in GitHub.