Frage

I was pretty certain that this should work, but I can't see what the issue is that's causing the missing operand. The loop seems to be working fine, but for some reason the _num variable isn't incrementing as it should. It seems that set /a isn't working as expected here.

@echo off

cls
cd \
cd /d D:\
set /a _num1=1
set /a _num=1
:LOOP 
if exist D:\%_num%.zip (
    set /a "%_num%+=%_num1%"
    goto LOOP
)

echo "%_num%.zip"
pause
exit
@echo on
War es hilfreich?

Lösung

if exist "D:\%_num%.zip" (
    set /a _num+=1
    goto LOOP
)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top