title: Makefile Windows -- remove directory if exists
body: <p>I am trying to port a Makefile to Windows (using GNU Make). I am having trouble with removing directories. I found this question (<a href="https://stackoverflow.com/questions/14502612/delete-a-directory-and-its-files-using-command-line-but-dont-throw-error-if-it-d">Delete a directory and its files using command line but don&#39;t throw error if it doesn&#39;t exist</a>) on how to conditionally remove directories, but I get an error trying to use that solution, translating approximately to <code>The use of ""doc\html"" is syntactically impermissible in this context</code></p>
  
  <p>The snippet causing it is this:</p>
  
  <p><code>if exists "doc\html\" rmdir /Q /S doc\html</code></p>
  
  <p>I also tried</p>
  
  <p><code>cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html</code></p>
  
  <p>and</p>
  
  <p><code>cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html</code>.</p>
  
  <p>I also tried <code>rmdir /Q /S doc\html 2&gt;nul</code>. That works kind of. The error gets redirected, but Make still throws an error and stops.</p>
  
  <p>How can I make this work?</p>