cd /d %~dp0 RD /S /Q Export Md Export FOR %%F IN (*.avi) DO ( set filename=%%F goto fin ) :fin ffmpeg -ss 00:01 -i %filename% -t 5 -f image2 .\Export\%%03d.png