command line arguments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Im a newbie to c#.net 2.0..
I need some info on command line arguments.
how do I pass command line arguments in a console applications..
 
Hi,

You need to have a main method defining a string[] as parameter

public static void Main(string[] args)
{
if(args.Length > 0 && args[0] == "/?")
// write help info
}

any word entered after your program name will be found in 'args'

If you are using Visual Basic, you can also use My.Application.CommandLineArgs any time.
 
Back
Top