Bonjour et meilleurs vœux à tout le monde
Je lance une commande (cmd) comme ceci :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| private void Bouton_Click(object sender, EventArgs e)
{
base.Enabled = false;
Application.DoEvents();
string arg = " -p " + textBox1.Text + " -y " + textBox2.Text + " -z " + comboBox1.Text + " -v " + comboBox2.Text + " -j 0 " + label1.Text;
Process process = new Process
{
StartInfo = { Arguments = arg, FileName = Application.StartupPath + "\\action.exe", CreateNoWindow = true, UseShellExecute = false }
};
process.Start();
process.WaitForExit();
MessageBox.Show("Ok !");
} |
Seulement voilà, ça ne fonctionne pas lorsque le chemin possède des espaces.
J'ai lu ici et là qu'il faudrait mettre des " sur le chemin des arguments mais comment faire car si j'écris ceci ça ne fonctionne pas (forcement ^^) :
string arg = "" -p " + textBox1.Text + " -y " + textBox2.Text + " -z " + comboBox1.Text + " -v " + comboBox2.Text + " -j 0 " + label1.Text;";
Merci de votre aide.
Partager