# Dos/Powershell mass rename



## greed (Feb 24, 2005)

Hi there

I'm looking for a script to use in cmd/powershell for renaming file extensions from .m4a to .m4b in a specific folder (including subfolders).

This is the old script I have saved (someone kindly figured it out for me long ago) which for some reason no longer seems to work:


```
FOR /F "tokens=*" %A IN ('dir "Z:\Music\iTunes\iTunes Music\Audiobooks" /b /s /ad /on') DO (
CD /D "%A"
REN *.m4a *.m4b
)
```
It's quite possible I have edited it accidentally and saved over the original resulting in the failing script above.

I'd be grateful if someone could show me what I've messed up or an alternative script which would do the same thing.

Thanks in advance!


----------



## foxidrive (Oct 20, 2012)

Change all %A to %%A

%A is used at the command line, usually in simpler commands.


----------

