@Echo Off Set DirPath=%1 mkdir %DirPath%\errors FOR %%i IN (%DirPath%\*.xhtml) DO c:\tools\tidy -file %DirPath%\errors\%%~ni.txt -clean -numeric -asxhtml -m %%i :EXIT