powershell - 快速启动本地应用程序

发布于 2024-08-13 01:21:57 字数 248 浏览 3 评论 0原文

我正在低规格硬件上构建一个信息亭类型配置脚本。

在脚本的最后,它运行各种应用程序供用户交互。我目前使用普通的 Invoke-Command“path\to\app.exe”。我希望尽快让界面启动并运行。我想异步启动应用程序。

我知道 Invoke-Command 中有 start-job 和 -asJob 标志,但它们似乎不适用于启动可视化应用程序。有办法做到这一点吗?

I am building a kiosk type config script on low-spec hardware.

At the end of the script, it runs the various apps for the user to interact with. I currently use a plain Invoke-Command "path\to\app.exe". I want to get the interface up and running as quickly as possible. I want to launch the apps asynchronous.

I know there is start-job, and the -asJob flag in Invoke-Command, but they don't seem to work with launching visual apps. Is there a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我做我的改变 2024-08-20 01:21:57

默认情况下,Windows 子系统(可视)EXE 异步启动。并且您不需要 Invoke-Command 来调用 exe。如果您像这样执行 notepad.exe:

PS> Notepad
PS>

请注意,当记事本仍在运行时,PowerShell 提示符会立即返回。这同样适用于脚本。

Windows subsystem (visual) EXEs start asynchronously by default. And you don't need Invoke-Command to invoke an exe. If you exeute notepad.exe like so:

PS> Notepad
PS>

Note that the PowerShell prompt returns immediately while notepad is still running. The same applies in a script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文