回复 7# ruoru376
试试这样需要几分钟- @echo off
- setlocal enabledelayedexpansion
- set fileNum=0
- set keyNum=0
-
- REM 获取关键词数量
- for /f "delims=" %%i in ('type "关键词.txt"') do (
- set /a keyNum+=1
- set "_!keyNum!=%%i"
- )
-
- REM 重命名
- for %%i in (文章\*.txt) do (
- set /a fileNum+=1
- set /a mod=!fileNum!%%!keyNum!
- if !mod! equ 0 (
- set mod=3
- )
- for /f %%j in ("_!mod!") do (
- ren "%%i" "%%~ni【!%%j!】%%~xi"
- )
- )
复制代码
|