Starting a console application from parameters

  • Thread starter Thread starter Fabri
  • Start date Start date
F

Fabri

I'm writing a Console Application and I would like to start it only if I
pass to it a param:

myapp.exe -s --> start
myapp.exe --> I write usage reference

How can i do this?

Any help appreciated.

Best regards.

--
fabri
Sei un italiano medio, di oltre trent'anni se:
Sai che il codice SYS64738 serviva per riavviare il Commodore 64 ed hai
cambiato almeno una mezza dozzina di joystick Quickshot I giocando a
Summer Games.
MKDS nick & friend Code:
Joker® - 055895 043343
 
Fabri said:
I'm writing a Console Application and I would like to start it only if I
pass to it a param:

myapp.exe -s --> start
myapp.exe --> I write usage reference

Public Shared Function Main( ByVal args As String() ) As Integer
If args.Length = 0 Then
' Display Usage
Return 1
End If
' rest of code
End Function

HTH,
Phill W.
 
Fabri said:
I'm writing a Console Application and I would like to start it only if I
pass to it a param:

myapp.exe -s --> start
myapp.exe --> I write usage reference

\\\
Public Module Program
Public Function Main(ByVal Args() As String) As Integer
For Each Arg As String In Args
MsgBox(Arg)
Next Arg
Application.Run(New MainForm())
If...Then
Return 0
Else
Return 1
...
End If
End Function
End Module
///

Select 'Sub Main' as startup object in the project properties.
 
Back
Top