Tiago Pinho

Tiago Pinho

  • NA
  • 9
  • 5.9k

Cannot get result from Process.Start ...

Jul 12 2010 11:22 AM
Dear friends,

Just arrived to C#Corner. I'm having a lot of problems getting a result that seems so obvious and easy.

Take a look at the following code:

Process p = new Process();

p.StartInfo.UseShellExecute = false;

p.StartInfo.RedirectStandardOutput = true;

p.StartInfo.FileName = "openssl\\openssl.exe";

p.StartInfo.Arguments = "\"2010-05-18;2010-05-18T11:22:19;FAC 001/14;3.12; \" | openssl dgst -sha1 -sign prikeyofs.pem | openssl enc -base64";

p.Start();

string output = p.StandardOutput.ReadToEnd();

p.WaitForExit();

This example returns an empty string. And why is this happening?

If I replace the file name for cmd and remove the arguments I get the usual "Microsoft Windows [Versão 6.1.7600]...". I can't even send the result to another file like "> something.txt".

Does anyone knows why is this happening.

Thanks in advance.

Best regards.

Answers (8)