title: .NET Environment.NewLine - how to setup programmatically
body: <p>I would like to change the default Environment.NewLine character for my current environment.</p>
  
  <p>I have one standalone application that is writing messages to a console. When the core framework works in the console environment the new line is \r\n. When I move the core framework into a Windows service the Environment.NewLine changes to "\n". </p>
  
  <p>I would like to be able to change the Console to always use "\r\n" because when I redirect the output of the console to a file the output has no "windows new lines" when read from example Notepad.</p>
  
  <p>I would like Console.WriteLine to use \r\n whenever I want.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I am redirecting Console.out:</p>
  
  <pre><code>        ConsoleOut = File.AppendText(fileName);
          ConsoleOut.AutoFlush = true;
  
  
          Console.SetOut(ConsoleOut);
          Console.SetError(ConsoleOut);
  </code></pre>
  
  <p>Every Console.WriteLine or Console.Write is sent to a file but as I said I am experiencing different behaviours in Windows Service and in standalone Windows environment.</p>