你贴出的代码是删除文件夹的而不是删除文件的。 @echo offfor %%a in (c d e f g h) do ( if exist %%a:\ ( pushd %%a:\ for /f "delims=" %%b in ('dir/a-d/s/b *.txt,*.reg,*.ini') do del /f /q "%%~b" >nul 2>nul popd ))pause