如何从终端 (cmd) 启动 windows 10 appx (UWP) 应用程序

how to start windows 10 appx (UWP) application from terminal (cmd)

我有 Visual Studio 2015 的开发机器 Windows 10 Desctop 并在调试模式下构建 UWP 应用程序(自定义单元测试)。我想 运行 我的 UnitTests 的调试版本所以尝试从 python 脚本(或只是 cmd.exe)启动我的 Appx,但只看到:

C:\Users\l_chayka\job_builds\unit_tests_win10\Debug>UnitTests.exe
The system cannot execute the specified program.

如果我从 Visual Stidio 启动 Appx 一切正常,我应该怎么做才能使 UWP 应用程序的调试版本从终端启动? 提前致谢。

有几种方法可以从命令行启动 appx:

1.Using window的启动菜单。可以参考Diogo在此post的回复。语法如下。您可以在命令行中保存到 vbs 脚本和 运行:

Set objShell = WScript.CreateObject("WScript.Shell")

objShell.SendKeys "^{ESC}"

WScript.Sleep 1000

objShell.SendKeys WScript.Arguments.Item(0)

WScript.Sleep 1000

objShell.SendKeys "{ENTER}"
  1. 使用 explorer.exe ( IE10) 启动已部署的应用程序,例如:"explorer.exe bingnews://"。可以参考这个post.

  2. 正在编程实现 IApplicationActivationManager 接口以加载应用程序。这也是根据window的注册表项找到有效的APPID。详细代码可以在这个 post 中找到。

希望对您有所帮助!