I want to execute this command in CMD using C#.
rstrui.exe
This works normally if I manually open CMD and run this command. It should start a system process called System restore. But it doesn't open the process if I do it using C#. Here is my method for running the commands in CMD.
public static string ExecuteCommand(string command)
{
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command)
{
CreateNoWindow = false
};
using (Process proc = new Process())
{
proc.StartInfo = procStartInfo;
proc.Start();
string output = proc.StandardOutput.ReadToEnd();
if (string.IsNullOrEmpty(output))
output = proc.StandardError.ReadToEnd();
return output;
}
}
This is the code for running the command.
ExecuteCommand("rstrui.exe");
Pls help me to run this command using C#. Thanks in advance.