title: how do I create a command line argument
body: <p>I currently have an .exe I am running in my C# code, the .exe collects a list of files from specific locations, once it runs it prompts user to press esc to exit or enter to re-collect. Because I am trying to run this as an automated process from my code I would like to add a command line argument like -s or something to bypass the prompt for user input. without bypassing this the .exe will never close and the software will eventually crash.
  Here is my .exe code</p>
  <pre><code>class StackGrabber
  {
      /// &lt;summary&gt;
      /// The main entry point for the application.
      /// &lt;/summary&gt;
      [STAThread]
      static void Main(string[] args)
      {
          try
          {
              StackReader.MessageHandler.OnMessage += new StackReader.MessageHandler.NotificationHandler(OnNotification);
  
              StackGrabber grabber = new StackGrabber();
              grabber.Grab();
          }
          catch (Exception ex)
          {
              DisplayMessage(ex.ToString());
          }
      }
  
      private volatile bool IsComplete = false;
      private StackReader.StackReader reader;
  
      void Grab()
      {
          try
          {
              DisplayMessage(&quot;Grabbing stacks... \n&quot;);
  
              reader = new StackReader.StackReader();
              reader.OnReadComplete += new System.Windows.Forms.MethodInvoker(OnComplete);
  
              if (reader.ReadStacks() &gt; 0)
              {
                  while (!reader.IsComplete)
                      Thread.Sleep(500);
              }
              else
              {
                  Thread.Sleep(500);
              }
              DisplayMessage(Environment.NewLine + &quot;Press esc to exit&quot; + Environment.NewLine);
                 //...
                 //...
              Console.Read();
          }
          catch (Exception ex)
          {
              DisplayMessage(ex.ToString());
          }
      }
  
      
      public static void OnNotification(string msg)
      {
          DisplayMessage(msg);
      }
  
      public void OnComplete()
      {
          IsComplete = true;
      }
  
      private static object ConsoleLock = new object();
      private static void DisplayMessage(string msg)
      {
          lock (ConsoleLock)
          {
              Console.WriteLine(msg);
          }
      }
  }
  </code></pre>
  <p>and I call the executable like this:</p>
  <pre><code>StackGrab.StartInfo.FileName = @&quot;..\\bin\\StackGrabber.exe&quot;;
              StackGrab.StartInfo.CreateNoWindow = true;
              StackGrab.StartInfo.UseShellExecute = false;
              StackGrab.Start();
              StackGrab.WaitForExit();
  </code></pre>
  <p>I want to be able to call StackGrabber.exe in a command prompt so that I put <code>C:\&gt;StackGrabber -s</code> and it doesnt wait for 'esc' input to exit</p>
  <h3>NOTE: this is a question about my software using C#2.0, Visual Studio 2005, and WinXP 32bit</h3>