批处理全盘搜索指定文件并删除,求指点!

目的:有盘符C、D、E、F、G、H、I、J 盘,全盘查找 "a.txt 、b.dat、123.exe、443.doc.." 多个文件并删除;

===============================================
@echo off
for %%a in (c d e f g h i j ) do ( call :del %%a)
:del
for /r %1:\ %%i in (a.txt) do del /f /q /s %%i
===============================================
这个批处理只能全盘查找a.txt并删除;
哪位高手帮改改,谢谢!

@echo off
for %%a in (c d e f g h i j) do (
for %%i in (a.txt b.dat 123.exe 443.doc) do (
del /s /f /q /a "%%a:\%%i"
)
)

需要再添加的话在第三行的括号里添加就行了,用空格隔开

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-05-15
for %%a in (c d e f g h i j) do (
for %%i in (a.txt b.dat 123.exe 443.doc) do (
del /s /f /q /a "%%a:\%%i"
)
)
相似回答