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"

另請參閱

適用於