title: Passing Command-line arguments from C# to a external exe
body: <p>I have a similar problem as already solved <a href="https://stackoverflow.com/questions/850802/piping-in-a-file-on-the-command-line-using-system-diagnostics-process">here</a>. But I can not figure out, how the problem got solved. I have a program that get paramter the define a input and output file. Running this from Commend line, all works fine:</p>
  
  <pre><code>D:\Tools\siftDemoV4&gt;siftWin32.exe -display &lt; D:\tmp\SrcPgm\image000.pbm &gt; result.pbm
  </code></pre>
  
  <p>But running via System.Diagnostics.Process, does not work. I get the error "Invalid command line argument: &lt;" and after this a System.InvalidOperationException occurs. </p>
  
  <pre><code>var process = new Process()
  {
     StartInfo =
     {
       Arguments = string.Format(@"-display &lt; {0} &gt; {1}", configuration.Source,
         configuration.Destination),
       FileName = configuration.PathToExternalSift,
       RedirectStandardError = true,
       RedirectStandardInput = true,
       RedirectStandardOutput = true,
       UseShellExecute = false,
       CreateNoWindow = true,
       ErrorDialog = false,
     }
  };
  
  process.EnableRaisingEvents = true;
  process.Exited += OnProcessExited;
  process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
  process.ErrorDataReceived += new DataReceivedEventHandler(process_ErrorDataReceived);
  process.Start();
  process.BeginOutputReadLine();
  process.BeginErrorReadLine();
  </code></pre>
  
  <p>I already tried to write to process.StandardInput after I called process.Start(), but when using the debugger, the external program was sometime already finished (HasExited==true).</p>
  
  <p>Can anybody explain how I can pass this special "&lt;" ">" parameters to the programm?</p>
  
  <p>Best Greetings!  </p>
  
  <p>By the way, I checked the path multiple time, they are correct.</p>