ConsoleApplicationBase.CommandLineArgs 속성

정의

현재 애플리케이션의 문자열을 명령줄 인수로 포함하는 컬렉션을 가져옵니다.

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

속성 값

현재 애플리케이션의 문자열을 명령줄 인수로 포함하는 StringReadOnlyCollection<T>입니다.

예제

이 예제에서는 My.Application.CommandLineArgs 애플리케이션의 명령줄 인수를 검사 하는 속성입니다. 로 시작 하는 인수가 있으면 /input=, 인수에 지정 된 나머지 표시 됩니다.

Private Sub ParseCommandLineArgs()
    Dim inputArgument As String = "/input="
    Dim inputName As String = ""

    For Each s As String In My.Application.CommandLineArgs
        If s.ToLower.StartsWith(inputArgument) Then
            inputName = s.Remove(0, inputArgument.Length)
        End If
    Next

    If inputName = "" Then
        MsgBox("No input name")
    Else
        MsgBox("Input name: " & inputName)
    End If
End Sub

설명

My.Application.CommandLineArgs 속성은 현재 애플리케이션의 ClickOnce 배포 되지 않는 애플리케이션에 대 한 명령줄 인수에 대 한 읽기 전용 액세스를 제공 합니다.

단일 인스턴스 애플리케이션의 경우는 My.Application.CommandLineArgs 속성에는 애플리케이션의 첫 번째 인스턴스에 대 한 명령줄 인수를 반환 합니다. 이후에 단일 인스턴스 애플리케이션을 시작 하려고 시도 대 한 인수에 액세스 하려면 처리 해야 합니다는 StartupNextInstance 이벤트 검사를 CommandLine 의 속성을 StartupEventArgs 인수.

참고

My.Application.CommandLineArgs 속성에는 명령줄 인수를 반환 합니다. 동작은 다릅니다는 CommandLine 인수 외에도 애플리케이션 이름을 반환 하는 속성입니다.

참고

ClickOnce로 배포 된 애플리케이션을 사용 하 여는 ActivationUri 의 속성을 My.Application.Deployment 명령줄 인수를 가져올 개체입니다. 자세한 내용은 Deployment를 참조하세요.

다음 표에서 관련 된 작업의 예제는 My.Application.CommandLineArgs 속성입니다.

대상 참조 항목
단일 인스턴스 애플리케이션을 시작 하는 후속 하려고의 명령줄 인수를 확인 합니다. StartupNextInstance

프로젝트 형식에 따라 가용성

프로젝트 형식 사용 가능
Windows 애플리케이션
클래스 라이브러리 No
콘솔 애플리케이션
Windows 컨트롤 라이브러리 No
웹 컨트롤 라이브러리 No
Windows 서비스
웹 사이트 No

적용 대상

추가 정보