Home > Net >  Batch file - would like to display a menu of folders in 3 columns
Batch file - would like to display a menu of folders in 3 columns

Time:12-12

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            
  • Related