本帖最后由 xp3000 于 2022-10-11 11:22 编辑
- @echo off&setlocal enabledelayedexpansion
- set m=1
- (for %%a in (*.txt) do (
- set/a "n+=1,1/(10*m-n+1)"||(set/am+=1)
- if !m! lss 100 (set "x=0!m!" & set x=!x:~-2!) else (set "x=00!m!" & set x=!x:~-3!)
- md 归类_!x!&move "%%a" .\归类_!x!\
- ))2>nul
复制代码 要是不处理set "x=00!m!" & set x=!x:~-3!替换为exit /b- @echo off&setlocal enabledelayedexpansion
- set m=1
- (@for /f "delims=" %%a in ('dir /b/a-d/on "*.txt"') do (
- set/a "n+=1,1/(1*m-n+1)"||(set/am+=1)
- if !m! geq 1000 (set "x=!m!") else (
- if !m! lss 100 (set "x=00!m!" & set x=!x:~-2!) else (set "x=00!m!" & set x=!x:~-3!)
- )
- md 归类_!x!&move "%%a" .\归类_!x!\
- ))2>nul
复制代码 再加个4位数以上的分组 |