@echo off
setlocal

set "extensionList=.bak .o .i"   REM 在此处列出要删除的文件扩展名列表，用空格分隔
echo del %extensionList% types file;
REM 递归删除文件函数
:DeleteFiles
for /R %%A in (*) do (
    for %%B in (%extensionList%) do (
        if "%%~xA" == "%%B" (
            echo Deleting "%%~nA%%~xA"
            del "%%A"
            )
        )
    )
goto :EOF
REM 删除当前目录下的子目录中的文件
for /D %%C in (*) do (
    echo Processing directory "%%C"
    pushd "%%C"
    call :DeleteFiles
    popd
    )
endlocal

pause