@echo off cd %1 if errorlevel 0 ( FOR %%j in (*.xml) DO ( echo processing %%~fj call ..\..\Tool\spgen.bat %%~fj ) cd .. )