I have a folder with various media files such as .m4a, .aac, .mp4, etc. and I want to invoke FFMPEG to convert them all to .mp3 using the basic FFMPEG command ffmpeg -i myfile.m4a myfile.mp3.

Can you show me a basic example of what this .bat text file would look like? I would like to iterate each media file using a type of wildcard so that it automatically runs.


Try this: (If you have all files in media type, no other types of files)

@echo off
Pushd "Filepath"
for %%a in (*) do (
  ffmpeg -i "%%~fa" "%%~na.mp3"
| improve this answer | |
  • works like a charm. many thanks! – Ronnie Royston Feb 8 at 17:50
  • Thank you so much a lot! – Wasif Hasan Feb 8 at 17:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.