Windows 批处理文件无法定位文件

标签 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)

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

最佳答案

路径没问题。只需删除文件名上的 ():

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)

关于Windows 批处理文件无法定位文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27511607/

相关文章:

java - 适用于 Windows 的 64 位版本的 Java 1.4.2?

c# - 检查 Windows 窗体滚动条是否一直向下滚动?

windows - 在 Windows 批处理中回显 UTF-8 字符

windows - 批量替换 !-sign

batch-file - 在批处理脚本中处理八进制变量

linux - 使用 GNU/Linux 的图像格式计算器和转换器

c++ - 等待 WaitForMultipleObjects

python - CUDA 问题 - 如何在 Win 10 中清理安装 CUDA 以解决 cudaGetDevice() 失败

Java批量监控

javascript - SAXON 错误 - 如何忽略/跳过它?