mardi 3 novembre 2015

Label loop crashes seemingly without reason

Don't ask me why, but I try to create a 5-digit code consisting of folders. The following code seemed promising, however at folder 0\0\1\0 it crashes: it returns that 0\0\1\0\%E% already exists. Definition for %E% can be found in the code.

@echo off
set A=0
set B=0
set C=0
set D=0
set E=-1

:A

set /a E=E+1
if %E%==10 (set E=0 && set /a D=D+1)
if %D%==10 (set D=0 && set /a C=C+1)
if %C%==10 (set C=0 && set /a B=B+1)
if %B%==10 (set B=0 && set /a A=A+1)
if %A%==10 goto B
mkdir %A%\%B%\%C%\%D%\%E%
REM pause to get the error
goto A

:B
echo 111.111 folders have been made
pause
exit

Looking for a fix or a new version alltogether.

Aucun commentaire:

Enregistrer un commentaire