title: How do I write the value of a variable to a dos text file?
body: <p>How do I write a variable value to a text file within a dos batch script?</p>
  
  <p>(Y, JJJ, SERL, and SERIAL are variables in the batch file)</p>
  
  <p>I tried the following:</p>
  
  <pre><code>set SERIAL=%Y%+%JJJ%+%SERL% 
  %SERIAL% &gt; VAR_1.TXT
  %T% &gt; VAR_2.TXT
  %A% &gt; VAR_3.TXT
  %SERL% &gt; VAR_4.TXT
  </code></pre>
  
  <p>The files VAR_!.txt, VAR_2.txt, VAR_3.txt, VAR_4.txt are created, but they are empty (0 bytes).</p>
  
  <p>I know this has a simple solution, but it has been 20+ years since I played with batch files (VERY rusty!)</p>
  
  <p>THANKS! </p>