Soit le code ci-dessous pour lancer une application console.
Margré un process.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden la fenêtre console
apparait à l'écran.
process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false; // On désactive le
shell
process.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden &
System.Diagnostics.ProcessWindowStyle.Minimized;
process.StartInfo.RedirectStandardOutput = true; //On redirige la
sortie standard
process.StartInfo.FileName = "consapp.exe"; //On définit la
commande
process.StartInfo.Arguments = "-V";
process.Start();
output = process.StandardOutput.ReadToEnd(); //Lecture de la
sortie de la commande
process.WaitForExit();
process.Close();
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Patrick Philippot
Bonjour,
Le mieux est peut-être de compiler l'application comme application Windows (/t:winexe) et de ne pas créer de fenêtre. Rien n'apparaîtra à l'écran.
-- Patrick Philippot - Microsoft MVP MainSoft Consulting Services www.mainsoft.fr
"Sylfelin" wrote in message news:
Soit le code ci-dessous pour lancer une application console. Margré un process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden la fenêtre console apparait à l'écran.
process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; // On désactive le shell process.StartInfo.WindowStyle > System.Diagnostics.ProcessWindowStyle.Hidden & System.Diagnostics.ProcessWindowStyle.Minimized; process.StartInfo.RedirectStandardOutput = true; //On redirige la sortie standard process.StartInfo.FileName = "consapp.exe"; //On définit la commande process.StartInfo.Arguments = "-V"; process.Start(); output = process.StandardOutput.ReadToEnd(); //Lecture de la sortie de la commande process.WaitForExit(); process.Close();
-- --- Sylfelin
Bonjour,
Le mieux est peut-être de compiler l'application comme application Windows
(/t:winexe) et de ne pas créer de fenêtre. Rien n'apparaîtra à l'écran.
--
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr
"Sylfelin" <sylfelinREMOVE@cegetelPOINT.net> wrote in message
news:mn.a3997d6646ede20f.47615@cegetelPOINT.net...
Soit le code ci-dessous pour lancer une application console.
Margré un process.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Hidden la fenêtre console apparait à
l'écran.
process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false; // On désactive le shell
process.StartInfo.WindowStyle > System.Diagnostics.ProcessWindowStyle.Hidden &
System.Diagnostics.ProcessWindowStyle.Minimized;
process.StartInfo.RedirectStandardOutput = true; //On redirige la
sortie standard
process.StartInfo.FileName = "consapp.exe"; //On définit la commande
process.StartInfo.Arguments = "-V";
process.Start();
output = process.StandardOutput.ReadToEnd(); //Lecture de la sortie
de la commande
process.WaitForExit();
process.Close();
Le mieux est peut-être de compiler l'application comme application Windows (/t:winexe) et de ne pas créer de fenêtre. Rien n'apparaîtra à l'écran.
-- Patrick Philippot - Microsoft MVP MainSoft Consulting Services www.mainsoft.fr
"Sylfelin" wrote in message news:
Soit le code ci-dessous pour lancer une application console. Margré un process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden la fenêtre console apparait à l'écran.
process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; // On désactive le shell process.StartInfo.WindowStyle > System.Diagnostics.ProcessWindowStyle.Hidden & System.Diagnostics.ProcessWindowStyle.Minimized; process.StartInfo.RedirectStandardOutput = true; //On redirige la sortie standard process.StartInfo.FileName = "consapp.exe"; //On définit la commande process.StartInfo.Arguments = "-V"; process.Start(); output = process.StandardOutput.ReadToEnd(); //Lecture de la sortie de la commande process.WaitForExit(); process.Close();
-- --- Sylfelin
Sylfelin
Patrick Philippot a exprimé avec précision :
Bonjour,
Le mieux est peut-être de compiler l'application comme application Windows (/t:winexe) et de ne pas créer de fenêtre. Rien n'apparaîtra à l'écran.
Je n'ai pas le source.
Mais j'ai trouvé je n'avait pas redirigé la sortie standard
process.StartInfo.RedirectStandardError = true;
-- --- Sylfelin
Patrick Philippot a exprimé avec précision :
Bonjour,
Le mieux est peut-être de compiler l'application comme application Windows
(/t:winexe) et de ne pas créer de fenêtre. Rien n'apparaîtra à l'écran.
Je n'ai pas le source.
Mais j'ai trouvé je n'avait pas redirigé la sortie standard