By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,640 Members | 1,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,640 IT Pros & Developers. It's quick & easy.

Starting a console application from parameters

P: n/a
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
Mar 24 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Fabri" <no@sp.am> wrote in message news:e0**********@nnrp.ngi.it...
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.
Mar 24 '06 #2

P: n/a
"Fabri" <no@sp.am> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Mar 24 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.