I have a C# Winform application. I want to start the application from the console (i.e. start the .exe from command prompt) and write some messages on it.
static void Main(string[] args)
{
string cmfile = string.Empty;
if (args.Length == 1)
cmfile = args[0];
Console.WriteLine("I want to read this line on CONSOLE");
MessageBox.Show("This is my Message", "Window Name"); //Just to PAUSE the program so that i can read the message written on the console in the line above
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(cmfile));
}
QUESTION: In the above code snippet, I want to see the string (i.e. "I want to read this line on CONSOLE") gets written on the console window, which started the .exe. How can I do that?