title: Reliably get non-localized output from a system command on Windows
body: <p><code>iisexpresstray</code> is a helper app that comes with IIS Express and shows info about running instances of this server. I wanted to learn how it works, so I decompiled this .NET program with ILSpy. In particular, my attention was drawn by a piece of code that runs a system command, namely <code>netsh http show servicestate view=requestq</code>:</p>
  
  <pre><code>string text;
  using (Process process = new Process()) {
      process.StartInfo.FileName = "netsh";
      process.StartInfo.Arguments = "http show servicestate view=requestq";
      process.StartInfo.CreateNoWindow = true;
      process.StartInfo.UseShellExecute = false;
      process.StartInfo.RedirectStandardOutput = true;
      process.Start();
      text = process.StandardOutput.ReadToEnd();
      process.WaitForExit();
  }
  </code></pre>
  
  <p>Nothing special so far, but then this code parses the output of this command expecting to find English substrings like <code>"Process IDs:"</code> and <code>"Registered URLs:"</code>, which are there only if the command's output isn't localized. And this somehow works, even on localized Windows. Moreover, <code>iisexpresstray</code> relies on this behavior.</p>
  
  <p>So how does this work? When I'm simply copypasting this snippet to LINQPad running on localized Windows, I expectedly see localized results. Setting <code>Thread.CurrentThread.CurrentCulture</code> doesn't change anything.</p>