using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Diagnostics; public partial class Form6 : Form { private int previousSelectedIndex = 0; private void button4_Click(object sender, EventArgs e) { String inputDivice = comboBox1.Text; String inputFile = textBox1.Text; ProcessStartInfo processStartInfo = new ProcessStartInfo(); Process newProcess = new Process(); processStartInfo.FileName = "cmd.exe"; // prendre le fichier "swich.html" comme exemple // là je dois acceder au repertoire c:\\Program Files\Nipper avec la commande "cd" mais je ne sais pas comment je peux l'acceder en tant que j'ai une autre commande que je dois l'executer processStartInfo.Arguments = " c:\nipper> nipper --" + inputDivice + "--input=" + inputFile + "--output= C:\\Users\\champion\\Desktop\\Nipper-Version-Installer\\swich.html"; //lance sans ouvrir de fenêtre ou en ouvrant une fenêtre processStartInfo.RedirectStandardOutput = true; processStartInfo.CreateNoWindow = false; //passe ou pas par ShellExecute processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardOutput = true; processStartInfo.RedirectStandardError = true; try { // Lancement du processus newProcess = Process.Start(processStartInfo); newProcess.StandardOutput.ReadLine(); newProcess.WaitForExit(10000); newProcess.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "!!!!"); } } }