How to change output filename in ffmpeg batch?
You can extract the file name directly from the for replacement parameter. No need to set a new variable at all.

for %f in (*.mp4) do ffmpeg -i "%f" -vn -ar 44100 -ac 1 -b:a 32k -f mp3 "%~nf.mp3"


If you want to do more complicated string munging, it's much more intuitive in Powershell:

ls *.mp4|foreach{
    ffmpeg -i $_ -vn -ar 44100 -ac 1 -b:a 32k -f mp3 $_.name.replace("mp4", "mp3")
}