ProcessStartInfo.ArgumentList プロパティ

定義

アプリケーションの起動時に使用するコマンド ライン引数のコレクションを取得します。 リストに追加された文字列は、以前にエスケープする必要はありません。

public:
 property System::Collections::ObjectModel::Collection<System::String ^> ^ ArgumentList { System::Collections::ObjectModel::Collection<System::String ^> ^ get(); };
public System.Collections.ObjectModel.Collection<string> ArgumentList { get; }
member this.ArgumentList : System.Collections.ObjectModel.Collection<string>
Public ReadOnly Property ArgumentList As Collection(Of String)

プロパティ値

コマンド ライン引数のコレクション。

次の使用例は、プロセスの開始情報に 3 つの引数を追加します。

var info = new System.Diagnostics.ProcessStartInfo("cmd.exe")
{
    ArgumentList = {
        "/c",
        "dir",
        @"C:\Program Files\dotnet" // The space character is escaped automatically.
    }
};

// The corresponding assignment to the Arguments property is:
var info = new System.Diagnostics.ProcessStartInfo("cmd.exe")
{
    Arguments = "/c dir \"C:\\Program Files\\dotnet\""
};
Dim info As New System.Diagnostics.ProcessStartInfo("cmd.exe")
info.ArgumentList.Add("/c")
info.ArgumentList.Add("dir")
info.ArgumentList.Add("C:\Program Files\dotnet")

' The corresponding assignment to the Arguments property is:
info.Arguments = "/c dir ""C:\Program Files\dotnet"""

注釈

ArgumentList Argumentsプロパティは互いに独立しており、同時に使用できるのはそのうちの 1 つだけです。 これらの API の主な違いは、ArgumentListは指定された引数をエスケープし、を呼び出すときにオペレーティング システムに渡される 1 つの文字列をProcess.Start(info)構築することです。 したがって、引数を適切にエスケープする方法がわからない場合は、ArgumentListよりもArgumentsを選択する必要があります。

Important

信頼されていないデータでこの型のインスタンスを使用することは、セキュリティ上のリスクです。 このオブジェクトは、信頼できるデータでのみ使用します。 詳細については、「すべての入力を検証する」を参照してください。

適用対象