command-line parameter

  • Thread starter Thread starter Sandro
  • Start date Start date
S

Sandro

Hi,
How can I create an EXE which gets a comand-line parameter?

Thanks,
Sandro
 
* "Sandro said:
How can I create an EXE which gets a comand-line parameter?

\\\
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
///

-- or --

\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.GetCommandLineArgs().Length - 1
Console.WriteLine(Environment.GetCommandLineArgs(i))
Next i
End Sub
///

In order to test the samples above, you must set the application's
startup object to 'Sub Main'. The 2nd sample code can be used at any
place inside a Windows Forms application too.
 
Hi,


Dim arParams() As String

arParams = Environment.GetCommandLineArgs

Dim intParam As Integer

For intParam = 0 To arParams.GetUpperBound(0)

Debug.WriteLine(arParams(intParam))

Next

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top