Windows bat: loop files in directories

后端 未结 2 861
北海茫月
北海茫月 2021-01-29 00:25

I\'m working on Windows. I have many jpg files in subdirectories of a directory. I don\'t know exactly the architecture of the directory, meaning that I don\'t know

2条回答
  •  深忆病人
    2021-01-29 01:26

    @Echo off&SetLocal EnableExtensions EnableDelayedExpansion
    
    For /d %%A in (C:\dir\*) Do (
        Set "Files="
        For /F "delims=" %%B in ('dir /S /B "%%~fA\*.jpg"') Do Set Files=!Files! "%%~fB"
        If defined Files echo process.bat !Files!
    )
    
    pause
    

提交回复
热议问题