如何列出文件夹中的子目录并将其名称存储在临时变量中?
答案 0 :(得分:4)
用于1级目录:
@echo off
setlocal enableDelayedExpansion
set "direcotries="
for /d %%a in (*) do (
set "direcotries=!direcotries!;%%a"
)
echo %direcotries%
用于递归搜索:
@echo off
setlocal enableDelayedExpansion
set "direcotries="
for /r /d %%a in (*) do (
set "direcotries=!direcotries!;%%a"
)
echo %direcotries%