Batch for loop with filename code {allfile}

The below snippet to convert video to audio worked with DOpus in the past (v12.x), now it does not.

@disablenosel:files
@nodeselect
@echo off
for %%x in {allfile} do (
	ffmpeg -i %%x -vn -ar 44100 -ac 2 -ab 128k -f mp3 "{sourcepath}%%~nx.mp3"
)
if not %ERRORLEVEL% equ 0 ( pause )

The problem seems to be in the for loop while using {allfile}

If there's a space in a name, it's probably not quoting the filenames the way the DOS for-loop wants, or maybe you need quotes around the first %%n.

But using DOS Batch for-loops for this is not the best way to do things as DOS Batch is arcane and falls over in lots of situations.

Opus will loop through multiple files for you without anything extra. This should do the same thing, and is a lot more simple:

@disablenosel:files
@nodeselect
@echo off
ffmpeg -i {filepath} -vn -ar 44100 -ac 2 -ab 128k -f mp3 {filepath|ext=mp3}
1 Like

That works, thanks for fast response!