ProcessStartInfo.ArgumentList Property


Gets a collection of command-line arguments to use when starting the application. Strings added to the list don't need to be previously escaped.

 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)

Property Value


A collection of command-line arguments.


This example adds three arguments to the process start info.

var info = new System.Diagnostics.ProcessStartInfo("cmd.exe");
info.ArgumentList.Add(@"C:\Program Files\dotnet"); // there is no need to escape the space, the API takes care of it

// or if you prefer collection property initializer syntax:

var info = new System.Diagnostics.ProcessStartInfo("cmd.exe")
    ArgumentList = {
        @"C:\Program Files\dotnet"

// 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:\Program Files\dotnet")

' The corresponding assignment to the Arguments property is:

info.Arguments = "/c dir ""C:\Program Files\dotnet"""


ArgumentList and the Arguments property are independent of one another and only one of them can be used at the same time. The main difference between both APIs is that ArgumentList takes care of escaping the provided arguments and internally builds a single string that is passed to operating system when calling Process.Start(info). So if you are not sure how to properly escape your arguments, you should choose ArgumentList over Arguments.

Applies to