CODE: [Copy to clipboard]@echo off for /f "delims=" %%a in ('dir /a:-d /o:-d /b "指定文件夹"') do set file=%%~na & goto next :next echo %file% pause