Bonjour,
J'ai ce code :
Cela me permet de crypter via GPG des fichiers.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 string path = string.Format(@"{0}\gpg.exe", @"C:\Program Files\GNU\GnuPG"); Console.WriteLine(command); var procStartInfo = new ProcessStartInfo(path, command) { WorkingDirectory = @"C:\Program Files\GNU\GnuPG", CreateNoWindow = false, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, RedirectStandardInput = true }; var proc = new Process { StartInfo = procStartInfo }; proc.Start(); proc.StandardInput.Flush(); // Get the output into a string string result = proc.StandardOutput.ReadToEnd(); string error = proc.StandardError.ReadToEnd();
Donc cela revient à ouvrir une commande dos, et taper une ligne de commande avec des paramètres passés au programme GPG.Exe.
A l’exécution de la ligneLa commande DOS me demande de répondre par Oui ou non, afin que le programme se termine.
Code : Sélectionner tout - Visualiser dans une fenêtre à part string result = proc.StandardOutput.ReadToEnd();
Je suis obligé de le faire manuellement, alors que j'aurai aimé que cela soit fait automatiquement par le programme....
Comment faire?
J'ai essayé un :Mais en vain...
Code : Sélectionner tout - Visualiser dans une fenêtre à part proc.standardInput.writeline("oui")
Merci par avance,
Partager