title: "Counter" in Batch
body: <p>I'm trying to make a Batch file that will increment a variable by 1 each time it loops, and then check if the variable is equal to 5, and if it isn't, it loops again. I know there's probably a while loop for this, but I didn't know how to do that, and I'm just enjoying learning Batch for fun right now</p>
  
  <p>Here's the code, it doesn't work the way it should, it just displays a 0: and then does nothing else. So how would I go about fixing it? I have a feeling I'm setting and incrementing the variable wrong, and maybe it's confused about the 2 if statements? (Does it have an else if....?) Anyways, thanks for the help</p>
  
  <pre><code>@echo off
  set /p i=0:
  goto A
  
  :A
  set /p i=i+1:
  if i != 5 goto C
  if i == 5 goto B
  
  :C
  echo Test :D
  
  :B
  pause&gt;nul
  </code></pre>
  
  <p>Note: I don't know a lot of Batch and I'm not a pro, but I like to learn and I'm just doing this for future reference, and because I enjoy it. So, this code probably isn't good, but I want to know how I can accomplish this.</p>