Please help me i have a .bat file in specific location i wanna to execute it and see what happening like if clicked on it manually, the problem is the .bat file running as pop up window for just moment and no process done, My code is like
int exitCode;
ProcessStartInfo processInfo;
Process process;
string command = @"D:\programs\PreRef\Run.bat";
processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
//processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;
// *** Redirect the output ***
processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;
process = Process.Start(processInfo);
process.WaitForExit();
// *** Read the streams ***
string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();
exitCode = process.ExitCode;
process.Close();
So Please help me to solve this problem.Note this .bat file run another .exe program and the text in the .bat file is like PreRef.exe "D:\programs\PreRef"