title: How can I have color text output in a windows batch file that is called with the output being redirected to a file?
body: <p>I am running a batch file with std output being redirected to a file and I want to get color text in the output that is being displayed on the console.  I have found something that gives the color text, but I can't figure out how to send it to the console. This works, but not when stdout is redirected:
  <a href="https://stackoverflow.com/a/5344911/1417694">How to have multiple colors in a Windows batch file?</a></p>
  
  <p>I call the batch file like this:<br>
  mybatch >myoutput.txt</p>
  
  <p>My batch file looks like this:</p>
  
  <pre><code>:: Sample Batch file
  @echo off
  @echo this goes to the text file when std output is redirected
  @echo this goes to the console &gt;CON
  call :ColorText 19 "This uses the above referenced method to print in blue, but doesn't go to the console" &amp; echo( 
  .
  .
  .
  :ColorText
      &lt;nul set /p ".=%DEL%" &gt; "%~2"
      findstr /v /a:%1 /R "^$" "%~2" nul
      del "%~2" &gt; nul 2&gt;&amp;1
      goto :eof
  </code></pre>
  
  <p>How can I get that text to go to the console?</p>