i want to build an application of both gui and batch interface by using
windows application project.
i check either passing any args or not. if no, then open the gui
application. if yes, use the batch interface.
my problem is that i can output the string to the dos prompt when running
the exe file at dos prompt:
c:\>test.exe /?
nothing was printed. i expected should print a string on the dos prompt.
should i use the Console object to print the string on the dos prompt?
the following is the codeing:
[STAThread]
static void Main(string[] args)
{
if(args.Length == 0) // start GUI
{
Application.Run(new Form1());
}
else // run batch
{
// Syntax: OutboundConsole.exe /[?|h] /[p|e|f] /[start|close]
// - UPPERCASE of option
// - If the one or more arguments are in wrong format, display syntax screen
Form1 obj = new Form1();
if(args[0].Equals("/?") || args[0].ToUpper().Equals("/H"))
{
obj.displayHelp();
}
}
}
private void displayHelp()
{
Console.WriteLine("Syntax: OutboundConsole.exe /[?|h] /[p|e|f]
/[start|close]");
//MessageBox.Show("test");
}