【发布时间】:2015-12-15 08:46:12
【问题描述】:
我有一些 html 文件:
pkg_mon_spt@id=6&page=1.html
pkg_mon_spt@id=7&page=1.html
pkg_mon_spt@id=8&page=1.html
pkg_mon_spt@id=6&page=2.html
pkg_mon_spt@id=7&page=2.html
我的批处理脚本要删除所有包含“page=1”字样的文件是:
@echo off
if exist *page=1.html del *page=1.html
pause
html 文件和批处理文件在同一个文件夹中。 当我运行批处理文件时,名称中包含单词“page=1”的 html 文件没有被删除。
怎么了?谢谢你的解释。
【问题讨论】:
-
为什么是
IF EXIST?简单批处理,只有这个命令,没有必要包含它。我的意思是DEL本身已经检查了文件是否存在,它不会删除不存在的东西。
标签: batch-file cmd