title: How to handle spaces in path names in for loop?
body: <p>Trying to use the path to the current script, and the path contains spaces in it. I can't seem to get it to work though:</p>
  
  <pre><code>C:\Test Directory&gt;dir
   Volume in drive C has no label.
   Volume Serial Number is 7486-CEE6
  
   Directory of C:\Test Directory
  
  08/31/2010  07:28 PM    &lt;DIR&gt;          .
  08/31/2010  07:28 PM    &lt;DIR&gt;          ..
  08/31/2010  07:28 PM                20 echoit.cmd
  08/31/2010  07:28 PM                94 test.cmd
                 2 File(s)            114 bytes
                 2 Dir(s)  344,141,197,312 bytes free
  
  C:\Test Directory&gt;type echoit.cmd
  @echo off
  echo %*
  
  C:\Test Directory&gt;type test.cmd
  @echo off
  
  for /f "tokens=*" %%a in ('%~dp0\echoit.cmd Hello World') do (
      echo %%a
  )
  
  C:\Test Directory&gt;test
  'C:\Test' is not recognized as an internal or external command,
  operable program or batch file.
  
  C:\Test Directory&gt;
  </code></pre>