@echo off for /f %%i in ('dir matplo*.exe /B') do (call :SUB1 %%i) GOTO :EOF :SUB1 %1