Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Get the command line arguments using the Sub Main array

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