1-column code is below. I'd like to expand "char" to 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz and then be able to display the options in 3 columns (21 items, 21 items, 20 items). Folder names over a certain length would have to be truncated. With 3 columns and potentially long folder names, long folder names would have to be truncated in the menu.
rem Set the number of lines per page, max 29
set "pageSize=29"
set "char=0123456789ACDEFGHIJKLMNOPQRSTUVWXYZ"
rem Load current directory contents
set "numNames=1"
for /D %%a in (*.) do (
set /A numNames+=1
set "name[!numNames!]= %%a"
)
cd ..
set /A numPages=(numNames-1)/pageSize+1
rem Show directory contents, one page at a time
set start=2
:ShowPage
set /A page=start/pageSize+1, end=start+pageSize-1
if %end% gtr %numNames% set end=%numNames%
cls
cd %folder%
echo Page %page%/%numPages% of %CD%
echo/
set "base=1"
set /A lastOpt=pageSize+base, j=base
for /L %%i in (%start%,1,%end%) do (
for %%j in (!j!) do echo !char:~%%j,1! - !name[%%i]!
set /A j+=1
)
rem Assemble the get option message
set "mssg= (B - Back): "
if %end% lss %numNames% (
if "%mssg%" equ " (B - Back): " (set "mssg= (") else set "mssg=%mssg%, "
set "mssg=!mssg!Z=Next page"
)
if "%mssg%" neq " (B - Back): " set "mssg=%mssg%): "
:GetOption
choice /C 0123456789ACDEFGHIJKLMNOPQRSTUVWXYZB /N /M "Choice%mssg%"
I've found batch file solutions to browse files/folders with GUI, but I don't want to do a call to GUI (Explorer) because I'd like to keep everything on the keyboard (slows progress down to switch back and forth between mouse and keyboard all the time).