【问题标题】:Makefile Windows -- remove directory if existsMakefile Windows -- 如果存在则删除目录
【发布时间】:2016-01-23 23:24:00
【问题描述】:

我正在尝试将 Makefile 移植到 Windows(使用 GNU Make)。我在删除目录时遇到问题。我发现了这个关于如何有条件地删除目录的问题 (Delete a directory and its files using command line but don't throw error if it doesn't exist),但尝试使用该解决方案时出现错误,大致翻译为 The use of ""doc\html"" is syntactically impermissible in this context

导致它的sn-p是这样的:

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-statement makefile directory exists rmdir


    【解决方案1】:

    命令是exist 而不是exists。我链接的线程中有一个错字...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-25
      • 2013-04-03
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      • 2015-11-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多