3

我正在尝试将 Makefile 移植到 Windows(使用 GNU Make)。我在删除目录时遇到问题。我发现了关于如何有条件地删除目录的问题(使用命令行删除目录及其文件,但如果它不存在则不抛出错误),但尝试使用该解决方案时出现错误,大致翻译为The use of ""doc\html"" is syntactically impermissible in this context

导致它的片段是这样的:

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 仍然抛出错误并停止。

我怎样才能使这项工作?

4

1 回答 1

7

命令exist不是exists。我链接的帖子中有错字...

于 2015-10-24T15:37:59.800 回答