每个txt是不是都只有一个[[????]]?如果是这样:- @echo off
- for /r %%a in (*.txt) do (
- for /f "delims=" %%b in ('findstr "[[" "%%a"') do (
- set "str=%%b"
- setlocal enabledelayedexpansion
- for /f "delims=[]" %%b in ("!str:*[=!") do ren "%%a" "%%b.txt"
- endlocal
- )
- )
- echo 搞定!&pause>nul
复制代码
|