title: How to minimize application to tray by using command line argument
body: <p>How can i minimize application to system tray by using command line argument.</p>
  
  <p>eg:when i open my application using command line like this.
  c:\myfile.exe totray</p>
  
  <p>i writed some code for that but it never worked.</p>
  
  <pre><code>static void Main(string[] args)
          {
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              if (args.Length &gt;0)
              {
                  MessageBox.Show(args[0]);
              }
              Application.Run(new Form1());
  
          }
  </code></pre>
  
  <p>Here the messagebox is showing with my argument "totray".
  so i just added code like </p>
  
  <pre><code>static void Main(string[] args)
          {
              Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              if (args.Length &gt;0)
              {
                 // MessageBox.Show(args[0]);
                  if (args[0] == "totray") {
                      Form1 frm1 = new Form1();
                      frm1.Hide();
                  }
              }
              Application.Run(new Form1());
  
          }
  </code></pre>
  
  <p>But this idea is not working.
  is it possible to do get the argument to the form?
  what code i need to write here?</p>