That %%f is being used as a special variable: the loop variable. As you can see it has a different syntax already: instead of %envvarname%, it's called %%x; percent mark only in the front and only a single letter allowed.
Mind you, DOS/Windows batch language is a completely ill-designed pile of shit.

There's an alternative called 4DOS and 4NT but it has its own, "proprietary" language. When I do batch files I use
GnuWin32, the native 32-bit Windows executables of the standard GNU tools (from Unix). (If you need the EXE's only, tell me.)
With the GNU tools, it's not much easier, though - again, because of the incredible clumsiness of the DOW/Windows batch language:
- As the inside of the loop consists of several instructions, you gotta make a subroutine. Such a construct cannot be defined in batch files, therefore, you need to make the batch file call itself as some kind of poor man's subroutine call.
- You need to enclose filenames into quotation marks so that filenames with spaces inside won't get split apart and processed as multiple command line parameters. However, the batch file does get the quotation marks, as well. If you try to compare strings that may possibly have spaces inside, you need to enclose them into quotation marks, otherwise you'll get a syntax error; "IF whatever this file name is == whatever" just doesn't work! However, if the string is already enclosed into quotation marks - because that's how you passed it to the batch -, you'll just unquote them and get back to the previous problem. Therefore, I use no spaces in filenames (convert them to underscores instead)!
- You cannot execute a command and then include its standard output as part of another command. This means, you cannot set an environment variable to a value that arrives via the standard output of a command. Therefore, you gotta create a temporary batch file, with a SET command in it, append the standard output of the command to this batch file and run the batch file, to have the value put into the variable. UGLY!
It's worth learning how to use the standard GNU tools as they are a standard, well-designed, continuously maintained sets of general purpose tools, and they will come very handy anyway if you need to switch to Unix some time (i.e. when Micro$oft gets bankrupt and Linux will become the only major OS in town, HAHAHA!

).
As for the actual problem, here's a sample batch file for you; it may give you syntax errors, though, I haven't tested it. I'm currently into DVD-ripping with GordianKnot and have developed quite a few similar, but much more complicated batch files - for automized audio conversion with BeSweet or LAME - that use the GNU tools and work similarly to GNU tools (with respect to command line options). If you're interested, contact me via E-mail!
if `%1` == `` goto all
echo `%1` | tr -d "\042`" | sed "s/\.mp3$/.wav/I;s/^/set INPUTNAME=/" > %TEMP%\whatever.bat
call %TEMP%\whatever.bat
del %TEMP%\whatever.bat
lame --decode %1 "%FILENAME%"
:all
for %%f in (*.mp3) do call %0 "%%f"