title: How can I reverse a string in Batch?
body: <p>I found this solution for reversing strings that worked before, but not any more for some reason:</p>
  
  <pre><code>setlocal enabledelayedexpansion
  set num=0
  :LOOP
  call set tmpa=%%advanced:~%num%,1%%%
  set /a num+=1
  if not "%tmpa%" equ "" (
  set string1=%tmpa%%string1%
  goto LOOP
  )
  </code></pre>
  
  <p>My message that I receive is:</p>
  
  <pre><code>The input line is too long.
  The syntax of the command is incorrect.
  </code></pre>
  
  <p>I simply need to reverse the string in the variable <code>%advanced%</code> and output it to <code>%string1%</code>.</p>
  
  <p>If reversing strings can be done in one line, that would be super helpful in the project I am working on. If it can be done without the <code>setlocal enabledelayedexpansion</code>, that would be even more helpful but I doubt it is be possible.</p>