I have hundreds of files I want to rename to match a new convention. Current convention is AA.BBBB.XXX I want to change it to BBBB.AA.XXX
I've cd'd into the folder which holds all of these files. I thought I could simply loop through the files and grab the substrings needed to reconstruct the file name. The problem is that %name% appears to be empty when echoed.
for %%f in (*) do (
set name=%%f
set arr=%name:~0,3%
set sta=%name:~3,5%
set rest=%name:~8,26%
set new=%sta%%arr%%rest%
echo f: %%f
echo name: %name%
echo arr: %arr%
echo sta: %sta%
echo rest: %rest%
echo new: %new%
set
pause
)
As you can see at the bottom I called 'set' so I can see what's going on with these variables. It shows %name% to be equal to what I expect, yet it shows empty when echoed and my other variable assignments are unable to pull substrings from %name%.