@echo off pushd Set Framework=\v4.0.30319 cd %1 :tryCompile Set current=%cd% REM Is there a .csproj file in the current location? If not exist *.*proj goto tryAgain REM found it --> build it. ECHO YES YES found proj file in: ECHO %cd% %SystemRoot%\Microsoft.NET\Framework%Framework%\msbuild.exe goto end :tryAgain ECHO NO proj file found in: ECHO %cd% cd .. REM detect if we are at the root level if "%current%"=="%cd%" goto end goto tryCompile :end popd PAUSE