How to traverse folder tree/subtrees in a windows batch file?

前端 未结 4 1029
刺人心
刺人心 2020-12-31 05:12

In a windows batch file, is there a way to traverse a folder/subfolders hierarchy doing some action on each file?

4条回答
  •  盖世英雄少女心
    2020-12-31 05:30

    Yes, you can do this using the for command with the /r switch, e.g.:

    for /r %%f in (*) do echo %%f
    

    See also this question for an example.

提交回复
热议问题