title: Process takes longer to finish than in CMD
body: <p>I am running a program that runs driverquery.exe command and gets back the ouput</p>
  
  <pre><code>        pProcess.StartInfo.CreateNoWindow = true;
          debugLog.WriteToLog("");
          pProcess.StartInfo.UseShellExecute = false;
          pProcess.StartInfo.RedirectStandardOutput = true;
          pProcess.StartInfo.WindowStyle =  System.Diagnostics.ProcessWindowStyle.Hidden;
          debugLog.WriteToLog("before start method");
          pProcess.Start();
          debugLog.WriteToLog("after start method");
          if (windowTitleToHide.Length &gt; 0)
          {
              WindowsUtil.HideWindow(windowTitleToHide);
          }
          if (null != attributeName &amp;&amp; !"".Equals(attributeName))
              Console.WriteLine(attributeName + " : ");
          debugLog.WriteToLog("before read to end");
  
          StreamReader reader = pProcess.StandardOutput;
          String strOutput = string.Empty;
  
          while (reader.Peek() &gt; -1)
              strOutput += reader.ReadLine();
  
          debugLog.WriteToLog("after read to end");
          Console.WriteLine(strOutput);
          debugLog.WriteToLog("before wait for exit");
          pProcess.WaitForExit();
          debugLog.WriteToLog("after wait for exit");
          pProcess.Close();
  </code></pre>
  
  <p>The process takes about 30 minutes to finish.If i run  the same process via cmd it always finishes in 2 minutes. I have tried using readtoend instead of readline but that also did not help. Can some tell what is wrong here? in my logs i can see the last line getting printed as <strong>before wait for exit</strong></p>
  
  <p>PS: When i see the processes in the taskmanager the driverquery.exe is running but not consuming any CPU cycles. The process calling this code is consuming about 99% CPU. I know for sure that the calling code is not doing any other task while running this code. </p>