@echo off setlocal for /f "usebackq tokens=*" %%a in (`dir /b /a:d`) do ( rem enter the directory pushd %%a echo In Directory: %%a ren "SRXXXXXXX_QA_ICE_Call&Ticket.xltx" "QA_ICE_Call&Ticket_SRXXXXXXX.xltx" rem leave the directory popd ) endlocal