title: Output command prompt arithmetic to txt file
body: <p>All, I was provided the below code as a replacement to part of a batch file which performed some functions and then called powershell to perform arithmetic against two variables.  The script outputs the result to the cmd window, but I am trying to figure out how to output to a txt file.  I've tried something as simple as <code>&gt; output.txt</code> but that's not working.  Any assistance is appreciated.</p>
  <pre><code>setlocal EnableDelayedExpansion
  
  ( set /P &quot;num1=&quot; &amp; set /P &quot;num2=&quot; ) &lt; test.txt
  
  rem Adjust *two* numbers for given decimals
  set &quot;decimals=2&quot;
  for %%i in (1 2) do (
     set &quot;num%%i=!num%%i:.=!&quot;
     for /L %%d in (1,1,%decimals%) do if &quot;!num%%i:~0,1!&quot; equ &quot;0&quot; set &quot;num%%i=!num%%i:~1!&quot;
  )
  
  set /A &quot;result=num1 - num2&quot;
  for /L %%d in (1,1,%decimals%) do if &quot;!result:~%decimals%!&quot; equ &quot;&quot; set &quot;result=0!result!&quot;
  
  echo !result:~0,-%decimals%!.!result:~-%decimals%!
  </code></pre>