I am trying to make a batch file that will increment a variable by 1 with each cycle, and then check if the variable is 5, and if not, then it repeats again. I know there is probably a while loop for this, but I did not know how to do this, and I am just enjoying learning Batch for fun right now.
Here's the code, it doesn't work as it should, it just displays 0: and then does nothing. So how can I fix this? It feels like I'm setting and incrementing a variable incorrectly, and maybe it gets confused with 2 if statements? (Does he have more if ....?) In any case, thanks for the help
@echo off set /pi=0: goto A :A set /pi=i+1: if i != 5 goto C if i == 5 goto B :C echo Test :D :B pause>nul
Note. I donβt know much Batch, and Iβm not a professional, but I like to study, and I just do it for future reference and because I like it. So this code is probably not very good, but I want to know how I can do this.
source share