@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
SET "sourcedir=U:\sourcedir"
FOR /f "tokens=2delims=[]" %%a IN (
'dir /b /a-d "%sourcedir%\[*]*[*].mkv" '
) DO (
SET "newname=%%a"
ECHO(REN "%sourcedir%\[*]%%a[*].mkv" "!newname:~1,-1!.mkv"
)
GOTO :EOF
This should fix your problem.
The required REN commands are merely ECHO
ed for testing purposes. After you've verified that the commands are correct, change ECHO(REN
to REN
to actually rename the files.