title: Implement a for loop or do while loop in windows md-dos batch file
body: <p>My coding for creating users is as follows:</p>
  
  <pre><code>@echo off
  echo.
  echo     SELECT OPTION
  echo     -------------
  echo.
  :menu
  echo     1- Create username
  echo     2- Create password
  echo     3- Delete username
  echo     4- Exit
  echo.
  pause
  set /p option=enter option 1 2 3 or 4:
  if "%option%"=="1" goto createuser
  if "%option%"=="2" goto createpass
  if "%option%"=="3" goto deluser
  if "%option%"=="4" goto exit
  
  :createuser
  echo Enter username
  set /p var=Username:
  net user %var% /add
  echo Username successfully entered
  goto exit
  
  :createpass
  echo Enter password
  set /p var=Username:
  net user %var% *
  echo Password successfully entered
  goto exit
  
  :deluser
  echo Enter user to be deleted
  set /p var=Username:
  net user %var% /del
  echo User successfully deleted
  goto exit
  
  :exit
  </code></pre>
  
  <p>It successfully runs when tested but would like to know how to successfully implement a for loop to see if user enters any option outside of numbers 1-4 such as an error. Also a for loop for when a user has been successfully added, if they would like to create another user or exit the program.</p>