1. echo off
    2. :continue
    3. set /p FileName=请输入文件:
    4. echo 正在搜索,请稍候...
    5. for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
    6. if exist %%a:\ (
    7. for /f "delims=" %%b in ('dir /a-d /s /b "%%a:\*test.bat" 2^>nul') do (
    8. if /i "%%~nxb" equ "test.bat" (
    9. echo 搜索结束,文件路径为:%%b
    10. for %%a in (%%b) do (
    11. echo 保留文件名及后缀信息:%%~nxa
    12. )
    13. )
    14. )
    15. )
    16. )
    17. goto continue