Language

Process.RunAsync メソッド

定義

オーバーロード

Name 説明
RunAsync(ProcessStartInfo, CancellationToken)

startInfoによって記述されたプロセスを非同期的に開始し、終了するまで待機し、終了状態を返します。

RunAsync(String, IEnumerable<String>, Boolean, CancellationToken)

指定したファイル名と省略可能な引数を使用してプロセスを非同期的に開始し、終了を待機し、終了状態を返します。

RunAsync(ProcessStartInfo, CancellationToken)

ソース:
Process.Scenarios.cs

startInfoによって記述されたプロセスを非同期的に開始し、終了するまで待機し、終了状態を返します。

[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus> RunAsync(System.Diagnostics.ProcessStartInfo startInfo, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAsync : System.Diagnostics.ProcessStartInfo * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus>
Public Shared Function RunAsync (startInfo As ProcessStartInfo, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ProcessExitStatus)

パラメーター

startInfo
ProcessStartInfo

プロセスの開始に使用される情報を含む ProcessStartInfo 。

cancellationToken
CancellationToken

非同期操作を取り消すトークン。 トークンが取り消されると、プロセスは強制終了されます。

返品

非同期操作を表すタスク。 タスクの値には、プロセスの終了状態が含まれます。 取り消しによりプロセスが強制終了された場合、 Canceled は true。

属性

例外

startInfo は nullです。

UseShellExecute は true に設定されます。

または

RedirectStandardInput、 RedirectStandardOutput、または RedirectStandardError が trueに設定されています。 代わりに、対応する標準ハンドル プロパティを使用してハンドルを指定します。

適用対象

RunAsync(String, IEnumerable<String>, Boolean, CancellationToken)

ソース:
Process.Scenarios.cs

指定したファイル名と省略可能な引数を使用してプロセスを非同期的に開始し、終了を待機し、終了状態を返します。

[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus> RunAsync(string fileName, System.Collections.Generic.IEnumerable<string>? arguments = default, bool silent = false, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunAsync : string * seq<string> * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Diagnostics.ProcessExitStatus>
Public Shared Function RunAsync (fileName As String, Optional arguments As IEnumerable(Of String) = Nothing, Optional silent As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ProcessExitStatus)

パラメーター

fileName
String

開始する実行可能ファイルの名前。

arguments
IEnumerable<String>

プロセスに渡すコマンド ライン引数。 nullまたは空のシーケンスを渡して、追加の引数なしでプロセスを開始します。

silent
Boolean

trueすると、標準の入力、出力、およびエラーが null デバイスにリダイレクトされ、プロセスによって表示されるコンソール出力が生成されないようにします。 falseすると、プロセスは親から標準ハンドルを継承します。

cancellationToken
CancellationToken

非同期操作を取り消すトークン。 トークンが取り消されると、プロセスは強制終了されます。

返品

非同期操作を表すタスク。 タスクの値には、プロセスの終了状態が含まれます。 取り消しによりプロセスが強制終了された場合、 Canceled は true。

属性

例外

fileName は nullです。

fileName が空です。

適用対象