本帖最后由 yhcfsr 于 2018-3-18 19:30 编辑
- @echo off
- REM 指定源目录
- set "SrcDir=D:\test"
- cd /d "%SrcDir%"
- for /f "delims=" %%a in ('dir /a-d/s/b *.txt^|findstr /r "任命 结果"') do (
- set "name=%%~na"
- setlocal enabledelayedexpansion
- set "name=!name:任命=*!"&&set "name=!name:结果=*!"
- for /f "tokens=2 delims=*" %%b in ("!name!") do ren "%%a" "%%b%%~xa"
- endlocal
- )
复制代码
|