Promote Your Blog

Monday, January 23, 2012

How To Use Command Line Arguments In Visual Basic

1. To get number of command line arguments:
Dim argc As Integer = Environment.GetCommandLineArgs().Length

2. To retrieve all command line arguments as array of strings:
Dim args() As String = Environment.GetCommandLineArgs()

3. To access a particular command line argument:
Dim progName As String = args(0).ToString

Remember, first argument i.e. args(0) is program name itself
==> Minimum value of argc is 1

No comments:

Post a Comment