ProcessStartInfo.ArgumentList プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
アプリケーションの起動時に使用するコマンド ライン引数のコレクションを取得します。 リストに追加された文字列は、以前にエスケープする必要はありません。
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
信頼されていないデータでこの型のインスタンスを使用することは、セキュリティ上のリスクです。 このオブジェクトは、信頼できるデータでのみ使用します。 詳細については、「すべての入力を検証する」を参照してください。