Are there patterns or cookbook-code for command line argumentschecking?

S

SharpieNewbie

I'm trying to create a command line app that can taken up to 5
parameters.

I'm wondering if there's any standard pattern or way that i can
provide my users the freedom to put the parameters in any order,
rather than a fixed order.

For example,

app.exe /v /b /s /r /t C:\testing

will work the same way as

app.exe C:\testing /v /b /s /r /t

Any guidances or hints will be much appreciated.
 
C

cfps.Christian

You could do something like split on spaces and take each parameter
individually and put it in a loop containing a switch statement.
 
J

Joris van Lier

SharpieNewbie said:
I'm trying to create a command line app that can taken up to 5
parameters.

I'm wondering if there's any standard pattern or way that i can
provide my users the freedom to put the parameters in any order,
rather than a fixed order.

For example,

app.exe /v /b /s /r /t C:\testing

will work the same way as

app.exe C:\testing /v /b /s /r /t

Any guidances or hints will be much appreciated.

I've written a blog entry about using attributes for linking Methods to
command-line parameters
http://whizzrd.spaces.live.com/blog/cns!36AFCF1E860E662E!115.entry

HTH

Joris van Lier
 

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

Top