I am starting a simple process using my c# code. I am able to open the cmd but not in the specified path and even the command is not executed, instead it shows The Handle is invalid error. It is done using simple winform application.
Below is my code:
var process = new System.Diagnostics.Process();
var startInfo = new System.Diagnostics.ProcessStartInfo
{
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
WorkingDirectory = @"D:\Work\Application",
FileName = "cmd.exe",
RedirectStandardInput = true,
UseShellExecute = false
};
process.StartInfo = startInfo;
process.Start();
process.StandardInput.WriteLine("timeout /t 10");
It worked a day before but then it didnt work. I cant see what the problem is