可以用类似的方法稍稍复杂点
@echo off
set file=
for /F %%A in ('dir /B *.phtml') do call :part2 %%A
goto end
:part2
set file=%1
ren %file% %file:~0,-6%.php
:end
@echo off
set file=
for /F %%A in ('dir /B *.phtml') do call :part2 %%A
goto end
:part2
set file=%1
ren %file% %file:~0,-6%.php
:end