rendered paste body@echo off
setlocal
set counter=0
for /f %%a in ('dir /b h:\*.pdf') do call :COUNTLOOP %%a
set /p input=Pick one!
echo.
CALL :CHOICE %input%
goto :END
:COUNTLOOP
set /a counter=%counter% + 1
set output=%counter%. %1
call :PRINTLINE %output%
goto :eof
:PRINTLINE
echo %*
goto :eof
:CHOICE
::echo You chose %*
set counter=0
for /f %%a in ('dir /b h:\*.pdf') do call :SHOWCHOICE %%a
goto :eof
:SHOWCHOICE
set /a counter=%counter% + 1
if %counter% EQU %input% echo You chose %1
goto :eof
:END
endlocal