title: How to quote spaces in the command of a "for /F" loop on Windows
body: <p>I have the following <code>for</code> command</p>
  
  <pre><code>for /F %s in ('"mas ter\gradlew.bat" -q -p mass ter') do echo %s
  </code></pre>
  
  <p>And I don't get it to work properly. It is not the actual use-case, but a much simplified example.</p>
  
  <p>Executing</p>
  
  <pre><code>"mas ter\gradlew.bat" -q -p "mas ter"
  </code></pre>
  
  <p>works fine,</p>
  
  <pre><code>"mas ter\gradlew.bat" -q -p mass ter
  </code></pre>
  
  <p>says that the project direcotry "mass" does not exist (extra "s" for distinguisihing purpose only),</p>
  
  <pre><code>mas ter\gradlew.bat -q -p mass ter
  </code></pre>
  
  <p>says command "mas" was not found.</p>
  
  <p>So far so expected, but now I want to get it working in the for loop.</p>
  
  <pre><code>for /F %s in ('mas ter\gradlew.bat -q -p mass ter') do echo %s
  </code></pre>
  
  <p>of course says again that command "mas" was not found,</p>
  
  <pre><code>for /F %s in ('"mas ter\gradlew.bat" -q -p mass ter') do echo %s
  </code></pre>
  
  <p>of course says again that project direcotry "mass" does not exist but now it comes,</p>
  
  <pre><code>for /F %s in ('"mas ter\gradlew.bat" -q -p "mass ter"') do echo %s
  </code></pre>
  
  <p>again says that command "mas" was not found. o_O</p>
  
  <p>And now I'm at wtf.<br>
  Why is this happening and how do I make it work?<br>
  It also does not work to escape the spaces with <code>^</code> characters.<br>
  Besides that, this wouldn't help, because the two paths are stored in parameters and are used like</p>
  
  <pre><code>for /F %s in ('"%script_path%\gradlew.bat" -q -p "%script_path%"') do echo %s
  </code></pre>