When you perform a rename with wildcards, you get unexpected results, if the length of the specified source and destination are different.

Example: If a folder contains:

abcd1234.xyz
abcd654321.xyz

performing:

cd "<Drive:>\Folder"
rename abcd*.xyz ef*.zyx

results in:

efcd1234.zyx
efcd654321.zyx

and then peforming:

rename ef*.zyx abcd*.xyz

results in:

abcd1234.xyz
abcd654321.xyz

Using WCRename "<Drive:>\Folder\abcd*.xyz" ef*.zyx

results in:

ef1234.zyx
ef654321.zyx

and then running:

WCRename <Drive:>\Folder\ef*.zyx "abcd*.xyz"

results in:

abcd1234.xyz
abcd654321.xyz

The syntax for using WCRename.bat is:

WCRename <Drive:>\Folder\source*.exts destination*.extd \[/s\]

where:

 Source   is the beginning replaceable character string or null. 
 exts   is the source extension or *. 
 destination   is the replacement character string or null. 
 extd   is the destination extension or * 
 /s   is an optional parameter for searching sub-directories. 

WCRename.bat contains:

                              @echo off                              setlocal                              if \{%1\}

\{\} goto syntax if not exist %1 goto syntax if \{%2\}

\{\} goto syntax set target=%2 set target=%target:\=% set target=%target::=% if \{%target%\}

\{%2\} goto tgt1 :syntax @echo Syntax: WCRENAME "<Drive:>\Folder\Source*.exts" "Destination*.extd" \[/s\] endlocal goto end :tgt1 pushd %~DP1 set target=%2 set target=%target:"=% for /f "Tokens=1* Delims=*" %%i in ('@echo %2') do set target1="%%i"&set target2="%%j" set target1=%target1:"=% set target2=%target2:"=% if "%target2%"

"" set target2=%target1%&set target1=* set source=%1 set source=%source:"=% set source2=%source% :src1 for /f "Tokens=1* Delims=\" %%i in ('@echo %source2%') do set source1="%%i"&set source2="%%j" set source2=%source2:"=% if "%source2%"

"" set source2=??\%source%&goto src1 set work=%source2:\=% if not \{%work%\}

\{%source2%\} goto src1 for /f "Tokens=1* Delims=*" %%i in ('@echo %source2%') do set source1="%%i"&set source2="%%j" set source1=%source1:"=% set source2=%source2:"=% set target1=%target1:"=% set target2=%target2:"=% if "%target1%"

"*" set target1= if "%source2%"

"" set source2=%source1%&set source1=* if "%target2%"=="." set target2=%source2% set source1=%source1:?=% for /f "Tokens=*" %%i in ('dir %source% /b /a-d %3') do call :lvl1 "%%i" popd endlocal goto end :lvl1 pushd %~DP1 set name=%~n1 set ext=%~x1 for /f "Tokens=*" %%i in ('@echo %%name:%source1%^=%target1%%%') do set newname=%%i rename "%name%%ext%" "%newname%%target2%" popd :end