mardi 1 septembre 2015

How to change the global variable value inside the loop or conditions in .bat?

Here's my batch command.

@ECHO OFF
setlocal enabledelayedexpansion
SET ONE=1
for /r C:\Users\office\Desktop\dump %%i in (*.jpg) do(
 IF %ONE%==1 (
   ECHO value is 1
   SET ONE=2
) ELSE IF %ONE%==2 (
   ECHO value is 2
) ELSE (
    ECHO no value
)
)

I try to set the value to ONE again in condition, but it's not working,how to set the global variable value in batch command.

Aucun commentaire:

Enregistrer un commentaire