在向ProcessLauncher.RunToCompletionAsync(添加了一些应用程序,如powershell.exe、cmd.exe、ipconfige.exe、ping.exe等,以便在Rasberry 3模式B上的windows 10物联网核心运行的UWP应用程序中使用这些应用程序之后,我将该应用程序添加到AllowedExecutableFilesList中,代码如下:
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\Windows\System32\cmd.exe"\0"c:\Windows\System32\ipconfig.exe"\0"c:\Windows\System32\ping.exe"\0"c:\Windows\System32\netsh.exe"\0"c:\Windows\System32\CommProxy.exe"\0"c:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe\0"之后,我将这段代码写到午餐powershell中,并发送命令进行处理:
var options = new ProcessLauncherOptions();
var standardOutput = new InMemoryRandomAccessStream();
var standardError = new InMemoryRandomAccessStream();
options.StandardOutput = standardOutput;
options.StandardError = standardError;
await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
try
{
var command = "get-date";
var path = @"C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe";
var result = await ProcessLauncher.RunToCompletionAsync(path, command, options);
}
catch
{}
});
}在ProcessLauncher.RunToCompletionAsync中,我的应用程序卡住了,从不支持任何正确或不正确的结果。我该怎么办?
发布于 2019-05-16 13:37:59
我知道现在有点晚了,但我最近遇到了这个问题。我尝试在我的UWP应用程序中与netsh一起使用PowerShell和ProcessLauncher。我的工作解决方案是,我将netsh.exe powershell.exe从system32(物联网Arm图像)文件夹复制到我的App文件夹并在本地使用。
OS => Windows Iot Version 10.0.17763.503
Board => Raspberry Pi 3没有注册表条目或任何其他需要。干净而简单
await ProcessLauncher.RunToCompletionAsync("netsh.exe", "?", options);https://stackoverflow.com/questions/43304747
复制相似问题