编写一个批处理文件删除与通配符文件
问题描述:
我有多个网站在同一文件夹建立,我想创建一个批处理文件,将删除他们每个人的缓存,而无需添加一个新行每个站点。比如我使用这样的:
I have multiple websites set up in the same folder, and I want to create a batch file that will delete the cache in each of them without having to add a new line for each site. For example I am using this:
del /S /Q D:\www\site-name\cache\*
这工作,但我要补充一个新的生产线在 D每一个网站:\\ WWW
。 DEL命令不支持:
Which works, but I have to add a new line for every site in D:\www
. The del command doesn't support:
del /S /Q D:\www\*\cache\*
那么,什么是更好的方式来做到这一点?
So what is a better way to do this?
答
我觉得这应该工作:
for /D %%f in ("D:\www\*") do @(
del /S /Q "%%f\cache\*"
)