[Solved] How to set C# application to accept Command Line Parameters? [duplicate]


All command line parameters are passed to your application through string[] args parameter.
The code below shows an example:

using System.Linq;

namespace MyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Contains("/REPORT1"))
            {
                /* Do something */
            }
            else if (args.Contains("/REPORT2"))
            {
                /* Do something */
            }
        }
    }
}

Then, in command prompt just use:

C:\MyApp\MyApp.exe /REPORT1

solved How to set C# application to accept Command Line Parameters? [duplicate]