|Hey Mush. |
The DBNames can also have more than one _ in them
You didn't mention that in your original post, the DBName was posted as one without spaces or other separators. I fell right into the trap LOL.
Here's another untested script for you to try, again you must supply the correct paths and remove the REM if you are happy with the outcome. Good hunting.
pushd c:\trial\||echo Pushd failed - job terminated&&exit/b
for /f "tokens=*" %%1 in ('dir /b *.bak') do (
echo Oldname = !oldname!
echo Newname = !newname!.bak
REM ren "!oldname!" "!newname!.bak"
Please come back & tell us if your problem is resolved.