Share via


ProcessLauncher.RunToCompletionAsync Method

Definition

Overloads

RunToCompletionAsync(String, String)

Launches a new process. This asynchronous function completes when the launched process terminates.

RunToCompletionAsync(String, String, ProcessLauncherOptions)

Launches a new process, including the specified options. This asynchronous function completes when the launched process terminates.

RunToCompletionAsync(String, String)

Launches a new process. This asynchronous function completes when the launched process terminates.

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)

Parameters

fileName
String

Platform::String

winrt::hstring

The name of the process to launch.

args
String

Platform::String

winrt::hstring

Arguments for running the process.

Returns

When the asynchronous operation completes, it contains the exit code from the launched process.

Attributes

Windows requirements

App capabilities
systemManagement

Remarks

This API requires the use of the IoT systemManagement capability, and the inclusion of iot in the IgnorableNamespaces list. Users can add the following to their Package.appmanifest: <iot:Capability Name="systemManagement"/>, and add iot to their existing list of IgnorableNamespaces.

To launch a process the .exe must either be contained in the .appx package or be registered in the allow list for this API. To add an .exe to the allow list modify HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher:AllowedExecutableFilesList and add your executable to the REG_MULTI_SZ formatted string.

For example:

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

See also

Applies to

RunToCompletionAsync(String, String, ProcessLauncherOptions)

Launches a new process, including the specified options. This asynchronous function completes when the launched process terminates.

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)

Parameters

fileName
String

Platform::String

winrt::hstring

File name of process to start.

args
String

Platform::String

winrt::hstring

Arguments for the specified process.

options
ProcessLauncherOptions

Associated options for running the process.

Returns

When the asynchronous operation completes, it contains the exit code from the launched process.

Attributes

Windows requirements

App capabilities
systemManagement

Remarks

This API requires the use of the IoT systemManagement capability, and the inclusion of iot in the IgnorableNamespaces list. Users can add the following to their Package.appmanifest: <iot:Capability Name="systemManagement"/>, and add iot to their existing list of IgnorableNamespaces.

To launch a process the .exe must either be contained in the .appx package or be registered in the allow list for this API. To add an .exe to the allow list modify HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\EmbeddedMode\ProcessLauncher:AllowedExecutableFilesList and add your executable to the REG_MULTI_SZ formatted string.

For example:

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

See also

Applies to