Why is this batch file not working as intended?

I can open a command prompt and enter the greatest FFmpeg command I have:

for /r %f in (*.flac) do ffmpeg.exe -i “%f” -ab 320k -map_metadata 0 -id3v2_version 3 “%~pnf.mp3”

Naturally, I don’t want to enter that command every single time, so I though make a batch file. But when I run the batch file, the window opens and closes really fast. Is this not a valid line of code for a batch file?

Add “pause” at the end of the batch file to keep the console open. Windows automatically closes the console window once the batch file is finished executing. Either way, your code should execute.

A movie line right there. :thumbsup:

I have tried that. When I run the command from a window normally, the process takes a significant amount of time and has a lot of output about each file. I would imagine running this line from a batch file would have the same output, no? Plus, the files never change when I run it from a batch file which means I know it isn’t actually running.

EDIT: I know what the problem is. When I open the command window, I shift + right click the folder in File Explorer and click “Open command window here” which automatically sets the working directory to the correct path. In the batch file, I never set the directory so it fails.

I just need to add this as the first in the batch file.

cd C:\Users\Matthew\Desktop\Temp