@echo off setlocal EnableDelayedExpansion cd /d "%~dp0" for /f "tokens=*" %%f in ('dir /b /s /a:d "%cd%\SetupComplete\*"') do ( if exist "%%f\SetupComplete.cmd" ( cd /d %%f start /b /wait cmd /c call "%%f\SetupComplete.cmd" ) ) cd /d "%~dp0" rem rmdir /s /q SetupComplete