【发布时间】:2023-02-14 14:12:29
【问题描述】:
我正在尝试从反应本机 Windows - 关闭计算机的 UWP 应用程序运行 cmd 命令。有什么办法吗???
我创建了一个 c# 本机模块,它创建了一个运行 cmd 命令的进程。总是得到“访问被拒绝”
【问题讨论】:
标签: uwp shutdown access-denied react-native-windows
我正在尝试从反应本机 Windows - 关闭计算机的 UWP 应用程序运行 cmd 命令。有什么办法吗???
我创建了一个 c# 本机模块,它创建了一个运行 cmd 命令的进程。总是得到“访问被拒绝”
【问题讨论】:
标签: uwp shutdown access-denied react-native-windows
不能直接从 UWP 应用运行 cmd 命令。 UWP 应用在沙盒中运行。您可以做的是创建一个运行命令的 .exe 文件。然后将 .exe 文件放入 UWP 包中,并通过调用 FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync() 从 UWP 应用程序启动 .exe 文件。 以下是步骤:
FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync API 启动 .exe 文件。
你可以在这里参考 Arya 的回答:Run an exe/batch file from UWP app。 其他一些文件相关:FullTrustProcessLauncher Class
【讨论】: