ProcessLauncher.RunToCompletionAsync 方法

定义

重载

RunToCompletionAsync(String, String)

启动新进程。 此异步函数在启动的进程终止时完成。

RunToCompletionAsync(String, String, ProcessLauncherOptions)

启动一个新进程,包括指定的选项。 此异步函数在启动的进程终止时完成。

RunToCompletionAsync(String, String)

启动新进程。 此异步函数在启动的进程终止时完成。

public:
 static IAsyncOperation<ProcessLauncherResult ^> ^ RunToCompletionAsync(Platform::String ^ fileName, Platform::String ^ args);
/// [Windows.Foundation.Metadata.Overload("RunToCompletionAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<ProcessLauncherResult> RunToCompletionAsync(winrt::hstring const& fileName, winrt::hstring const& args);
[Windows.Foundation.Metadata.Overload("RunToCompletionAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<ProcessLauncherResult> RunToCompletionAsync(string fileName, string args);
function runToCompletionAsync(fileName, args)
Public Shared Function RunToCompletionAsync (fileName As String, args As String) As IAsyncOperation(Of ProcessLauncherResult)

参数

fileName
String

Platform::String

winrt::hstring

要启动的进程的名称。

args
String

Platform::String

winrt::hstring

运行进程的参数。

返回

异步操作完成后,它将包含启动进程的退出代码。

属性

Windows 要求

应用功能
systemManagement

注解

此 API 需要使用 IoT systemManagement 功能,并在 IgnorableNamespaces 列表中包含 iot。 用户可以将以下内容添加到其 Package.appmanifest <iot:Capability Name="systemManagement"/>,并将 iot 添加到其现有的 IgnorableNamespaces 列表中。

若要启动进程,.exe 必须包含在 .appx 包中或注册到此 API 的允许列表中。 若要将 .exe 添加到白名单,请修改 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher:AllowedExecutableFilesList ,并将可执行文件添加到REG_MULTI_SZ格式字符串。

例如:

reg ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /f /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\windows\system32\cmd.exe\0"

另请参阅

适用于

RunToCompletionAsync(String, String, ProcessLauncherOptions)

启动一个新进程,包括指定的选项。 此异步函数在启动的进程终止时完成。

public:
 static IAsyncOperation<ProcessLauncherResult ^> ^ RunToCompletionAsync(Platform::String ^ fileName, Platform::String ^ args, ProcessLauncherOptions ^ options);
/// [Windows.Foundation.Metadata.Overload("RunToCompletionAsyncWithOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<ProcessLauncherResult> RunToCompletionAsync(winrt::hstring const& fileName, winrt::hstring const& args, ProcessLauncherOptions const& options);
[Windows.Foundation.Metadata.Overload("RunToCompletionAsyncWithOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<ProcessLauncherResult> RunToCompletionAsync(string fileName, string args, ProcessLauncherOptions options);
function runToCompletionAsync(fileName, args, options)
Public Shared Function RunToCompletionAsync (fileName As String, args As String, options As ProcessLauncherOptions) As IAsyncOperation(Of ProcessLauncherResult)

参数

fileName
String

Platform::String

winrt::hstring

要启动的进程文件名。

args
String

Platform::String

winrt::hstring

指定进程的参数。

options
ProcessLauncherOptions

用于运行进程的关联选项。

返回

异步操作完成后,它将包含启动进程的退出代码。

属性

Windows 要求

应用功能
systemManagement

注解

此 API 需要使用 IoT systemManagement 功能,并在 IgnorableNamespaces 列表中包含 iot。 用户可以将以下内容添加到其 Package.appmanifest <iot:Capability Name="systemManagement"/>,并将 iot 添加到其现有的 IgnorableNamespaces 列表中。

若要启动进程,.exe 必须包含在 .appx 包中或注册到此 API 的允许列表中。 若要将 .exe 添加到白名单,请修改 HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher:AllowedExecutableFilesList ,并将可执行文件添加到REG_MULTI_SZ格式字符串。

例如:

reg ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher" /f /v AllowedExecutableFilesList /t REG_MULTI_SZ /d "c:\windows\system32\cmd.exe\0"

另请参阅

适用于