Forums - C# Corner

Forum guidelines
Tiago Pinho

Tiago Pinho

  • 1.3k
  • 9
  • 4.2k

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)

techbash 2016

SPONSORED BY

C# Corner Chandigarh DevCon16
Chandigarh DevCon16 is a one-day Developer Conference where programmers, technologists, authors, and members meet, demonstrate, plan, and hang out.