Executing a console app:
ConsoleApp.exe -switch2
with the following class produces this output:
Switch two activated.
Class definition:
public class ConsoleApp
{
static void Main(string[] args)
{
if (args != null && args.Length > 0)
{
switch (args[0].Trim().ToLower())
{
case "-switch1":
Console.WriteLine("Switch one activated.");
break;
case "-switch2":
Console.WriteLine("Switch two activated.");
break;
default:
Console.WriteLine("No options selected");
break;
}
}
else
Console.WriteLine("No options selected");
}
}
--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"CLEAR-RCIC" <CL*******@discussions.microsoft.com> wrote in message news:9A**********************************@microsof t.com...
I want to write a windows app that accepts command line arguments. Does
anyone know if this can be done and if so, how to do it.