我正在尝试将Makefile移植到Windows(使用GNU Make)。我在删除目录方面遇到了问题。我在这个问题上找到了答案(Delete a directory and its files using command line but don't throw error if it doesn't exist),但是我在尝试使用该解决方案时出现错误,大约翻译为“在此上下文中语法上不允许使用”doc \ html“”。
导致错误的代码片段是:
```if exists "doc\html\" rmdir /Q /S doc\html```
我也尝试了以下的代码:
``` cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html ```
和
``` cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html ```
我还尝试过 ```rmdir /Q /S doc\html 2>nul``` 这个命令有点用,但是错误会被重定向,但Make仍会抛出错误并停止。
如何使其工作?
导致错误的代码片段是:
```if exists "doc\html\" rmdir /Q /S doc\html```
我也尝试了以下的代码:
``` cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html ```
和
``` cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html ```
我还尝试过 ```rmdir /Q /S doc\html 2>nul``` 这个命令有点用,但是错误会被重定向,但Make仍会抛出错误并停止。
如何使其工作?