Forums - C# Corner

Forum guidelines
Tiago Pinho

Tiago Pinho

  • 1.3k
  • 9
  • 4.3k

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)

File APIs for .NET – 25% off Aspose.Total
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more! Use coupon code HOL2016PSB