1 @echo off 2 Setlocal Enabledelayedexpansion 3 set "str=【课出自】" 4 5 ::ren "%%b" "22_%%b" 6 7 for /d %%a in (*) do ( 8 pushd "%%a" 9 echo %%a 10 for /f "delims=" %%i in ('dir /b *.*') do (echo %%i & set "var=%%i" & ren "%%i" "!var:%str%=!") 11 popd 12 )
注意aaa.bat 文件要ansii码保存。不然处理不了中文的。