title: how to apply substring command to double percent variable in XP cmd scripts?
body: <p>here is the example how you do it with normal variables:</p>
  
  <pre><code>SET _test=123456789abcdef0
  SET _result=%_test:~-7%
  ECHO %_result%
  :: that shows: abcdef0
  </code></pre>
  
  <p>But what to do with variables with double percent at the begin (like <code>%%A</code>), variables like this are needed in for loops:</p>
  
  <pre><code>FOR /D %%d IN (c:\windows\*) DO (
    echo %%d
  )
  </code></pre>
  
  <p>this works, but:</p>
  
  <pre><code>FOR /D %%d IN (c:\windows\*) DO (
    echo %%d:~-7%
  )
  </code></pre>
  
  <p>simply copies <code>:~-7</code> into the echo command</p>