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)

속성 값

명령줄 인수의 컬렉션입니다.

예제

이 예제에서는 프로세스 시작 정보에 세 개의 인수를 추가합니다.

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 서로 독립적이며 그 중 하나만 동시에 사용할 수 있습니다. 이러한 API ArgumentList 간의 주요 차이점은 제공된 인수를 이스케이프하고 내부적으로 호출 Process.Start(info)할 때 운영 체제에 전달되는 단일 문자열을 빌드한다는 것입니다. 따라서 인수를 제대로 이스케이프하는 방법을 잘 모르는 경우 선택 ArgumentListArguments해야 합니다.

Important

신뢰할 수 없는 데이터와 함께 이 형식의 인스턴스를 사용하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터에서만 이 개체를 사용합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

적용 대상