@echo off setlocal enabledelayedexpansion cd .\prepared_steps for /d %%f in (*.*) do ( if exist "%%f\command.bat" ( echo Running command from %%f for /f "usebackq delims=" %%c in ('type "%%f\command.bat"') do ( call %%c ) ) else ( echo No command.bat found in %%f ) ) :: Exit the script goto :EOF