title: Batch script: The syntax of the command is incorrect - when script is going trough subdirectories?
body: <p><strong>Hello folks,</strong> </p>
  
  <p>my problem is probably very simple. </p>
  
  <p>When I`m trying to use /r as a reference for batch script to go trough all the folders and subs in order to execute this small script I get the "The syntax of the command is incorrect" error.</p>
  
  <pre><code>    @echo off
  setlocal enabledelayedexpansion enableextensions
  for /r %%f in ("*[]*.*") do (
      set oldname=%%f
      set newname=!oldname:[]=!
      echo !oldname!
      echo !newname!
      pause
      ren !oldname! !newname!
  )
  </code></pre>
  
  <p>However, when I remove /r this actually works, without any problem:</p>
  
  <pre><code>    @echo off
  setlocal enabledelayedexpansion enableextensions
  for %%f in ("*[]*.*") do (
      set oldname=%%f
      set newname=!oldname:[]=!
      echo !oldname!
      echo !newname!
      pause
      ren !oldname! !newname!
  )
  </code></pre>
  
  <p>So, how I can make the this script go trough all of the folders and subs, without problems as well?</p>
  
  <p>Thanks</p>