set /a ttl=0
set /A Counter=1
set /A Counter=0
:: this eliminates having to test for "one lessthan", i think...
:: also move the incrementation, as shown
if exist "c:\test\abc" (
FOR /f "tokens=*" %%G IN (' dir/b c:\test\abc\*.*') do (
set /A Counter+=1
echo !Counter!. %%G "c:\test\abc"
at end of each loop:
set /p usrin=Which number do you want to use?
if !usrin! gtr !ttl! (
echo exceeds menu, not accepted: !usrin!
) else (
echo ok, here we go with !usrin!...)
none of this addresses "validation of user input" however, which is always the hardest part of any system, believe me!