private string ExecuteCommand(string command) { ProcessStartInfo startInfo = new ProcessStartInfo() { FileName = "cmd.exe", UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true }; var myProcess = Process.Start(startInfo); myProcess.StandardInput.WriteLine(command); myProcess.StandardInput.WriteLine("Exit"); string output = myProcess.StandardOutput.ReadToEnd(); myProcess.Close(); return output; }