@echo off
setlocal enabledelayedexpansion

if not exist Uebung01 exit
cd Uebung01
del *.pdf OR *.png > nul
for %%f in (*.tex) do (
   @echo !time!: %cd%\%%f
   pdflatex -quiet "%%f"
   pdflatex -quiet "%%f" )
   REM magick mogrify -quality 85 -format png *.pdf
cd ..

del *.pdf OR *.png > nul
for %%f in (*.tex) do (
   @echo !time!: %cd%\%%f
   xelatex -quiet "%%f"
   xelatex -quiet "%%f" )

del *.aux OR *.bbl OR *.blg OR *.gz OR *.idx OR *.ilg OR *.ind OR *.log OR *.nav OR *.out OR *.snm OR *.toc OR *.vrb OR *.gnuplot /s > nul