title: Windows Batch For Loop How?
body: <p>I have below code and I like to repeat the process based on INPUT Y at the line:</p>
  
  <p>REM If value below is Y, repeat the process
     SET /P repeat=do you want to do the same for other systems ?:</p>
  
  <p>How do I do that by using LOOP? </p>
  
  <pre><code>@ECHO OFF
  :: List of Systems as Vairable
  set "SB1=hannlsb1.mydomain.com:30515 -i 05"
  set "DB1=hannlsd2.mydomain.com:31315    -i 13"
  set "QB1=hannlsqa1-1:30115 -i 01"
  set "DB0=hannlsd1.mydomain.com  -i 10"
  set "QB0=hannlsps1-1.mydomain.com-i 03"
  set "WB1=hannlsqa1-1:30315 -i 03"
  set "VB1=hannlsvt-1.mydomain.com    -i 01"
  
  SET /P isid=Please enter isid:
  SET /P pass=Please enter password to be reset:
  
  REM NEED LOOP Here
  SETLOCAL ENABLEDELAYEDEXPANSION
  SET /P sysid=Please enter SystemID:
  FOR /F "usebackq delims==" %%i IN (`echo+!%sysid%!`) DO SET val=%%i
  SETLOCAL DISABLEDELAYEDEXPANSION
  
  IF NOT "%val%"=="" (
     REM ECHO Hello %sysid%, Welcome to DOS inputs!
     ECHO %val%
     REM If value below is Y, repeat the process
     SET /P repeat=do you want to do the same for other systems ?:
  ) ELSE (
     ECHO You did not enter Correct System ID! Bye bye!!
  )
  pause
  </code></pre>