Get the command line arguments using the Sub Main array : Command Line « Development « VB.Net Tutorial






Module Module1

    Sub Main(ByVal cmdArgs() As String)

        Dim strArg As String

        If cmdArgs.Length > 0 Then
            For Each strArg In cmdArgs
                Select Case strArg.Substring(0, 3)
                    Case "/a1"
                        Console.WriteLine("Processing arg1: Value is {0}.", _
                            strArg.Substring(3, strArg.Length - 3))
                    Case "/a2"
                        Console.WriteLine("Processing arg1: Value is {0}.", _
                            strArg.Substring(3, strArg.Length - 3))
                End Select
            Next strArg
        End If
    End Sub


End Module








7.2.Command Line
7.2.1.Get the command line arguments using the Sub Main array
7.2.2.Determine whether command line arguments are present