set BASEDIR=”D:\TEST”
for /r %BASEDIR% %%i in (*.txt) do ren “%%i” “%%~ni.bak”