Thanks SAKryukov,
According to your comment, I added time in WaitForExit(). Then after som much tme it should exit and return ! But it doesn't return, its still waiting only.
try
{
ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
ProcessInfo.UseShellExecute = false;
ProcessInfo.RedirectStandardOutput = true;
Process = Process.Start(ProcessInfo);
string result = Process.StandardOutput.ReadToEnd();
Console.WriteLine("Process Result = " + result);
Process.WaitForExit(30000);
}
As I said, the command doesn't stop untill I press F4 key. With the command, it gets connected to the server and text keeps on coming on the prompt. I want to read the text and as I find the text "Connected" want to return and inform the user that "the app is connected to the server".
I understand that Process.Exitcode also wont return and so is Process.close.
What changes are required for solving my issue. I believe their must be some way to run any such command that doesn't exit immediately but only after giving any Exit command like F4,etc.
Thanks