3
Comment exécuter CMD à partir de C# sans afficher les fenêtres cmd?Comment exécuter CMD à partir de C# avec un CMD masqué
Comment exécuter CMD à partir de C# sans afficher les fenêtres cmd?Comment exécuter CMD à partir de C# avec un CMD masqué
En ProcessStartInfo
il y a un paramètre appelé CreateNoWindow
public static string ExecuteCommand(string command) {
ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/c " + command)
{
RedirectStandardError = true,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
};
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;
}
}
Check out http://stackoverflow.com/questions/1096591/how-to-hide-cmd-window-while-running-a-batch-file - très similaire à ce que vous voulez faire – InSane