title: How to use ANSI escape sequences with CSCRIPT on Windows 10?
body: <p>I'm trying to use the new VT100 ANSI escape sequence capabilities available in the Windows 10 console with CSCRIPT (JScript). But I cannot get it to work.</p>
  
  <p>Here is a really simple JScript script:</p>
  
  <p><strong>test.js</strong></p>
  
  <pre><code>WScript.Echo('\x1B[7mReverse\x1B[0m Normal');
  WScript.stdout.WriteLine('\x1B[7mReverse\x1B[0m Normal');
  </code></pre>
  
  <p>I've done a number of tests, and the escape sequences output by CSCRIPT are impotent when written directly to the screen, and only work if written to a file first and then TYPEed, or else captured by FOR /F and ECHOed.</p>
  
  <p><a href="https://i.stack.imgur.com/XmhBV.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/XmhBV.jpg" alt="enter image description here"></a></p>
  
  <p>I have two questions:</p>
  
  <p>1) Why doesn't the direct write to the console work from CSCRIPT?<br>
  2) How can I get the direct write to work?</p>
  
  <p>I would like to add text highlighting to my <a href="http://www.dostips.com/forum/viewtopic.php?f=3&amp;t=6044" rel="noreferrer">JREPL.BAT regular expression find/replace utility</a> (hence the <a href="/questions/tagged/batch-file" class="post-tag" title="show questions tagged &#39;batch-file&#39;" rel="tag">batch-file</a> tag), but I will not implement that feature if it requires a temporary file and/or FOR /F.</p>