If still having issues, memory?, you could try this:
set avidemux="C:\Program Files\Avidemux 2.5\avidemux2.exe"
for %%f in (*.avi) do (
%avidemux% --force-alt-h264 --load "%%f" --run aq27.js --save "%%f.mkv" --quit
%avidemux% --help --quit
)The second avidemux line should clear some stuff (files, ...) after finishing each encode
Should this fail to, change the avidemux lines form position.
No guarantee this will work, can't test this: no windows.