Windows批处理文件无法找到文件

时间:2014-12-16 18:35:20

标签: windows batch-file batch-processing

以下是一个简短的批处理文件。

if exist ("help/user/Content/build.xml") ( echo file exists) ELSE (echo File Deleted)
if exist ("archibus.war") (echo File not deleted!) ELSE (echo File Deleted)
if exist ("build.xml") ( echo file exists) ELSE (echo File Deleted)

即使文件确实存在,也永远不会找到它们。我没有正确指定路径吗?

1 个答案:

答案 0 :(得分:2)

路径还可以。只需删除文件名上的()

if exist "help/user/Content/build.xml" ( echo file exists) ELSE (echo File Deleted)
if exist "archibus.war" (echo File not deleted!) ELSE (echo File Deleted)
if exist "build.xml" ( echo file exists) ELSE (echo File Deleted)