@echo off & setlocal enableextensions
::
:: CHOOSE.EXE is a 16-bit executable
if defined ProgramW6432 (
echo/
echo Exiting: %~f0 is incompatible with 64-bit Windows
goto :EOF)
::
:: Test for CHOOSE.EXE availability at path / in the current folder
for %%f in ("CHOOSE.EXE") do set found_=%%~$PATH:f
if exist CHOOSE.EXE set found_=CHOOSE.EXE
if "%found_%"=="" (
echo CHOOSE.EXE choice.com clone not found.
echo Available from
tscmd.zip
goto :EOF)
::
echo Press x to exit the loop
::
:
_loop
set /a i_+=1
choose /n /c:nx /tn,0 > nul
if %errorlevel% NEQ 2 goto
_loop
::
echo i_=%i_%
^(cycles
^)
endlocal & goto :EOF
The output would be e.g.
C:\_D\TEST>cmdfaq
Press x to exit the loop
i_=37 (cycles)