@echo off
for /f "delims=" %%i in ('dir /s /b c:\*bb.txt') do call :lp "%%i"
pause&goto :eof
:lp
set str=%~nx1
set str=%str:bb=cc%
ren %1 %str%
goto :eof
或者开启变量延迟:
@echo off
for /f "delims=" %%i in ('dir /s /b c:\*bb.txt') do (
set str=%%~nxi
setlocal enabledelayedexpansion
set str=!str:bb=cc!
ren "%%i" !str!
endlocal
)
pause
Last edited by zw19750516 on 2008-4-17 at 11:48 AM ]