I have searched through Google and here found many examples but I can't seem to get my Windows Form application to run and take arguments form the command line. I really want to have the option of scheduling the application without having a console version. But every time I setup the cmd line arguments it errors out with a CLR20r3 error.
static void Main(string[] args)
{
if(args != null && args.Length > 0)
{
/*
* arg[1] = Backup Location *require
* arg[2] = Log File - Enable if present *optional
* arg[3] = Debug Messages - Enabled if present *optional
* arg[4] = Backup Type - Type to perform *required
*/
}
else
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
Application.Run(new Form1());
}
}
Anytime I try to pass an arg it errors ex
myapp.exe "C:\Backup\" => CLR20r3