本帖最后由 qixiaobin0715 于 2021-6-5 22:29 编辑
最好指定文件后缀,这里是.txt。未测试,可能代码有误,思路应当没问题:- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d *.txt') do (
- set "str=%%i"
- for /f "tokens=* delims=0123456789" %%j in ("%%i") do set "str=!str:%%j=!"
- for /f "tokens=* delims=0" %%k in ("!str!") do set "n=%%k"
- set /a "n1=((n-1)/20)*20+1"
- set /a "n2=((m-1)/20+1)*20"
- if not exist !n1!-!n2! md !n1!-!n2!
- move "%%i" "!n1!-!n2!"
- )
- pause
复制代码
|