title: How to make bat file listing with options to choose
body: <p>I want to make a bat file that list all of the files in a specific directory, and add numbers at the beginning of the every one of the listed items. This numbers need to be a selectable options.</p>
  
  <p>Example:
  I have a folder with 5 files in it, aaa.exe, bbb.exe, ccc.exe, ddd.exe, eee.exe. When i run bat file i need to see</p>
  
  <blockquote>
    <ol>
    <li>aaa.exe</li>
    <li>bbb.exe</li>
    <li>ccc.exe</li>
    <li>ddd.exe</li>
    <li>eee.exe</li>
    </ol>
  </blockquote>
  
  <p>So now if i wana run 5-th exe i need to press 5, than press enter and that 5th exe will now start. </p>
  
  <p>I allredy find how to list all of the items in folder with this code</p>
  
  <pre><code>REM -start "c:\windows\system32" notepad.exe 
  for /r %%i in (*) do echo %%i
  pause
  exit
  </code></pre>
  
  <p>but i can't figure out how to add numbers in front of the text and make that numbers to be a selectable options.</p>
  
  <p>Edit---</p>
  
  <p>Now im getting </p>
  
  <blockquote>
    <p>ERROR: Duplicate choices are not allowed. running '""' is not
    recognized as an internal or external command, operable program or
    batch file.</p>
  </blockquote>
  
  <p>when i'm trying to run this loop for a second time.</p>
  
  <p>This is code that i wrote:</p>
  
  <pre><code>@ECHO OFF
  setlocal enabledelayedexpansion
  
  
  REM ---Prompt part
  :choise
  SET /P AREYOUSURE=Install programs (Y/[N])?  
  IF /I "%AREYOUSURE%" EQU "Y" GOTO :chooseInstall
  IF /I "%AREYOUSURE%" EQU "N" GOTO :nope
  
  REM --Cheking for Y or N
  GOTO :choise
  
  :nope
  echo "Ok. Have a nice daty / night"
  pause
  exit
  
  
  
  :chooseInstall
  echo Wich program do you wana install ?
  echo.
  echo 1. 7Zip
  echo 2. CPU Z
  echo.
  
  SET /P AREYOUSURE=Choosing: 
  IF /I "%AREYOUSURE%" EQU "1" set "pathToSoft=C:\Users\usr\Desktop\hello"
  IF /I "%AREYOUSURE%" EQU "2" set "pathToSoft=C:\Users\usr\Desktop\bye"
  
  
  echo.
  echo.
  
  echo %pathToSoft%
  
  echo.
  echo.
  
  
  REM ---Installs
  echo "Wich file to install"
  
  cd %pathToSoft%
  echo.
  echo.
  
  
  
  REM --Loops that scan files
  
  set /A counter=0
  
  
  for /R %%i in (*) do (
  
  if not "%%~nxi" == "%~nx0" (
      set /A counter+=1
      echo !counter!: %%~nxi
      set exe[!counter!]=%%i
      set choice=!choice!!counter!
      )
  )
  
  if %counter% LSS 10 (
  choice /C %choice% /M "Choose: "
  set EXENUM=!ERRORLEVEL!
  ) else set /P EXENUM="enter exe number: "
  
  
  set EXECUTABLE=!exe[%EXENUM%]!
  echo running %EXECUTABLE%
  call "%EXECUTABLE%"
  
  echo.
  echo.
  echo.
  
  
  
  
  
  :installmore
  SET /P INSTALLMORE=Do you wana install somthing else (Y/[N])?  
  IF /I "%INSTALLMORE%" EQU "Y" GOTO :chooseInstall
  IF /I "%INSTALLMORE%" EQU "N" GOTO :nope
  </code></pre>