@echo off&setlocal enabledelayedexpansion
for /f "tokens=*" %%i in ('dir /b /a-d') do (
set "str=%%~ni"
set str=!str:pdf=pdf !
call:st !str!
echo ren "%%i" "!sttr!%%~xi"
)
pause&exit
:st
set "s=%1"
set sttr=
for /l %%i in (0,1,50) do (
if "!s:~%%i,1!"==" " goto:eof
set sttr=!sttr!!s:~%%i,1!
)