Passing command line arguments to a console application

  • Thread starter Thread starter Ed Willis
  • Start date Start date
E

Ed Willis

How do you read parameters that are entered for a console application

myprog /r

how can I get the /r in the Sub Main?

Thanks.
 
Ed Willis said:
How do you read parameters that are entered for a console application

myprog /r

how can I get the /r in the Sub Main?

\\\
Public Sub Main(ByVal astrCmdLineArgs() As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs.Length - 1
Console.WriteLine(astrCmdLineArgs(i))
Next i
End Sub
///
 
Hi Ed,

Declare your sub main as follows:

Public Sub Main(Arguments() As String)

For Each strArgument As String In Arguments
Console.WriteLine(strArgument)
Next

End Sub

That will print each argument to the console.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
 
Back
Top