title: Batch for loop with multiple commands and enabledelayedexpansion for a beginner
body: <p>I need some batch-noob-treatment.</p>
  
  <p>I'm trying to rename all the files in a folder and I'm slowly getting there, but although I got the step right with some google help, I would like to know what I'm doing.</p>
  
  <p>Here is my code until now:</p>
  
  <pre><code>@ECHO OFF
  setlocal enabledelayedexpansion
  
  set a="dir /b"
  FOR /F "delims=" %%i IN (' %a% ') DO (
  set str=%%i
  set str=!str:~1!
  echo !str!
  )
  </code></pre>
  
  <p>Anything else I put inside the for loop brings out strange results. I know the <code>enabledelayedexpansion</code> and <code>!</code> are somehow connected and make this work, but how is the inside of a for loop different from the normal commands in batch, so that special syntax is needed?</p>
  
  <p>What goes wrong if I put in code like that:</p>
  
  <pre><code>@ECHO OFF
  
  set a="dir /b"
  FOR /F "delims=" %%i IN (' %a% ') DO (
  set i=%i:~1%
  echo %%i
  )
  </code></pre>