回复 newswan
感谢帮助,但是 运行下来,不行
ngb0519 发表于 2021-5-13 13:27  - @echo off
- chcp 936
- setlocal enableDelayedExpansion
-
- set str=01 山东 02 四川
-
- for /f "usebackq tokens=* delims=" %%a in (` dir /b *.docx `) do (
- call :f1 "%%a" %str%
- )
- goto :END
-
- rem %0 %str% index
- :f1
- if not "%2"=="" (
- echo %1 | findstr /r "^[^0-9]*%3" >nul
- if !errorlevel!==0 (
- echo "%~1" "%2_%~1"
- goto :eof
- )
- shift /2 & shift /2
- goto :f1
- )
- goto :eof
-
- :END
复制代码
|