title: How can I start a process with stdin redirected, but not stdout?
body: <p>I'm trying to start a subprocess with stdin redirected to a handle of my own creation, but leaving stdout and stderr pointed at the child process's console window.</p>
  
  <p>Example:</p>
  
  <pre><code>var processStartInfo = new ProcessStartInfo(m_Exe)
  {
      UseShellExecute = false,
      RedirectStandardInput = true,
  };
  m_Process = new Process {StartInfo = processStartInfo};
  m_Process.Start();
  m_StdIn = m_Process.StandardInput;
  
  // write a line to the subprocess
  m_StdIn.WriteLine("");
  </code></pre>
  
  <p>The problem is that setting RedirectStandardInput also causes stdout and stderr to be intercepted. If RedirectStandardInput is left unset, the output of the child process is correctly sent to the child process's console window.</p>
  
  <p>Looking at the underlying win32 apis, <a href="http://msdn.microsoft.com/en-gb/library/windows/desktop/ms686331%28v=vs.85%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-gb/library/windows/desktop/ms686331%28v=vs.85%29.aspx</a> says:</p>
  
  <blockquote>
    <p>If dwFlags specifies STARTF_USESTDHANDLES, this member [hStdOutput] is
    the standard output handle for the process. Otherwise, this member is
    ignored and the default for standard output is the console window's
    buffer.</p>
  </blockquote>
  
  <p>We have to set STARTF_USESTDHANDLES in order to redirect stdin; is there any other way to direct stdout to the console window?</p>