1.

Solve : increment a variable?

Answer»

Is there a way to INCREMENT a variable in a BATCH file such as the way its done in C? (tick++ or ++tick)

ThanksTwo alternatives:

Method (1)

Can be USED in a loop or parenthetical expression, or elsewhere:

Code: [Select]set /a variable+=1
Method (2)
Code: [Select]set /a variable=%variable% + 1
In a loop or parenthetical expression you must USE delayed expansion and

Code: [Select]set /a variable=!variable!+1



Discussion

No Comment Found