批处理(BAT)读取目录下所有目录并写入变量中
读取目录下所有目录写到变量中
@echo off
setlocal enabledelayedexpansion
set list=
for /d %%i in (..\*) do set LIST=!list! %%i
选中目录特殊处理
for %%i in (%list%) do (
set str=%%i
set substr=!str:~3,3!
set flag=0
if "!substr!"=="loc" set flag=1
if "!substr!"=="map" set flag=1
if "!flag!"=="1" (
echo deal with data: %%i
cd %%i
)
)
echo done...
pause