using System; using System.Collections.Generic; using System.Windows.Forms; namespace CommandLineSample { static class Program { /// /// The main entry point for the application. /// [STAThread] //static void Main(string[] args) { static void Main() { Application.EnableVisualStyles(); bool flag = false; string name = ""; int number = 0; //// *Very* simple command line parsing //for( int i = 0; i != args.Length; ++i ) { // switch( args[i] ) { // case "/flag": flag = true; break; // case "/name": name = args[i]; break; // case "/number": number = i; break; // default: MessageBox.Show("Invalid args!"); return; // } //} string[] args = Environment.GetCommandLineArgs(); // *Very* simple command line parsing // Note: Starting at item [1] because item [0] is exe path for( int i = 1; i != args.Length; ++i ) { switch( args[i] ) { case "/flag": flag = true; break; case "/name": name = args[i]; break; case "/number": number = i; break; default: MessageBox.Show("Invalid args!"); return; } } Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } } }