本帖最后由 flashercs 于 2022-2-8 14:46 编辑
- @echo off
- cd /d "%~dp0"
- set prefix=test
- set delims=_
- @REM 目录深度 level
- set level=2
- @REM 每层建立文件夹数量 dirnum
- set dirnum=3
-
- call :mdfoo "%prefix%" 0
- exit /b
-
- :mdfoo pre n
- setlocal
- if %~2 geq %level% (
- 2>nul md %1
- goto end
- )
- set /a n=%~2+1
- for /l %%A in (1,1,%dirnum%) do (
- call :mdfoo "%~1\%~nx1%delims%%%A" %n%
- )
- :end
- endlocal
- exit /b
复制代码
|