Execute un prg et recup les infos

Résolu
droozsonic Messages postés 2 Date d'inscription vendredi 21 février 2003 Statut Membre Dernière intervention 31 janvier 2006 - 31 janv. 2006 à 15:05
droozsonic Messages postés 2 Date d'inscription vendredi 21 février 2003 Statut Membre Dernière intervention 31 janvier 2006 - 31 janv. 2006 à 15:28
Bonjour

je cherche à executer un programme sous une fenêtre DOS
pour ça pas de problème voiçi mon code

Process MyProcess = new Process();
MyProcess.StartInfo = new ProcessStartInfo(@"c:\.......exe");
MyProcess.Start();

le problème est que le programme renvoi des lignes dans la fenêtre DOS et j'aimerai les recuperer. Comment faire???

merci pour votre aide

Stef

2 réponses

Lutinore Messages postés 3246 Date d'inscription lundi 25 avril 2005 Statut Membre Dernière intervention 27 octobre 2012 41
31 janv. 2006 à 15:19
Salut, tu dois rediriger la sortie :

ProcessStartInfo.RedirectStandardOutput
3
droozsonic Messages postés 2 Date d'inscription vendredi 21 février 2003 Statut Membre Dernière intervention 31 janvier 2006
31 janv. 2006 à 15:28
Merci beaucoup

ca fonctionne nickel

voiçi mon morceau de code

Process MyProcess = new Process();
MyProcess.StartInfo = new ProcessStartInfo(@"c:\........exe");
MyProcess.StartInfo.UseShellExecute = false;
MyProcess.StartInfo.RedirectStandardOutput = true;
MyProcess.Start();
this.textBox1.Text = MyProcess.StandardOutput.ReadToEnd();

Stef
0
Rejoignez-nous