Language

Process.Run メソッド

定義

オーバーロード

Name 説明
Run(ProcessStartInfo, Nullable<TimeSpan>)

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

Run(String, IEnumerable<String>, Boolean, Nullable<TimeSpan>)

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

Run(ProcessStartInfo, Nullable<TimeSpan>)

ソース:
Process.Scenarios.cs

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

[System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Diagnostics.ProcessExitStatus Run(System.Diagnostics.ProcessStartInfo startInfo, TimeSpan? timeout = default);
[<System.Runtime.Versioning.SupportedOSPlatform("maccatalyst")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member Run : System.Diagnostics.ProcessStartInfo * Nullable<TimeSpan> -> System.Diagnostics.ProcessExitStatus
Public Shared Function Run (startInfo As ProcessStartInfo, Optional timeout As Nullable(Of TimeSpan) = Nothing) As ProcessExitStatus

パラメーター

startInfo
ProcessStartInfo

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

timeout
Nullable<TimeSpan>

プロセスが終了するまで待機する最大時間。 nullすると、無期限に待機します。 指定されたタイムアウト内にプロセスが終了しない場合、プロセスは強制終了されます。

返品

プロセスの終了状態。 タイムアウトのためにプロセスが強制終了された場合、 Canceled は true。

属性

例外

timeoutは、ミリ秒の整数に切り捨てられ、-1 より小さいか、 MaxValueより大きい値です。

startInfo は nullです。

UseShellExecute は true に設定されます。

または

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

適用対象

Run(String, IEnumerable<String>, Boolean, Nullable<TimeSpan>)

ソース:
Process.Scenarios.cs

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

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

パラメーター

fileName
String

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

arguments
IEnumerable<String>

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

silent
Boolean

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

timeout
Nullable<TimeSpan>

プロセスが終了するまで待機する最大時間。 nullすると、無期限に待機します。 指定されたタイムアウト内にプロセスが終了しない場合、プロセスは強制終了されます。

返品

プロセスの終了状態。 タイムアウトのためにプロセスが強制終了された場合、 Canceled は true。

属性

例外

timeoutは、ミリ秒の整数に切り捨てられ、-1 より小さいか、 MaxValueより大きい値です。

fileName は nullです。

fileName が空です。

適用対象