Dynamic Multi Level Menu
Posted: 02 Sep 2014 13:13
Hopefully someone out there has an idea how to create a dynamic multi level menu.
I have a Folder structure approx. 3 levels deep. My current solution has been to hardcode these menu's, however my users add new install folders almost everyday, I'd prefer a solution which cuts me out of the loop. A dynamic menu seems ideal.
Our folder structures looks something like this:
Folder1
Folder1a
Folder1b
Folder1c
Folder1c1
Folder2
Folder2a
Folder2b
Folder2b1
and so on....
Essentially these folders are software install folders, I need to allow the users to navigate (via a DOS menu) to, say, 'Folder2b1'. Importantly the entire path with be included in the final command line, for instance:
%Folder2%\%Folder2b%\%Folder2b1%
I found an example script but I can't workout how to extend it further to include additional levels.
Sample script:
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set fname=%~n0
rem echo %fname%
cls
set count=1
for /D %%f in (Folder*) do (
SET Folder=%%f
echo.
echo !count! - %%f
set mis!count!=%%f
set /A count=!count!+1
)
set /A count=%count%-1
echo.
set /P input=Please select or 0 (zero) to exit [1-%count%]:
Any advice is appreciated.
I have a Folder structure approx. 3 levels deep. My current solution has been to hardcode these menu's, however my users add new install folders almost everyday, I'd prefer a solution which cuts me out of the loop. A dynamic menu seems ideal.
Our folder structures looks something like this:
Folder1
Folder1a
Folder1b
Folder1c
Folder1c1
Folder2
Folder2a
Folder2b
Folder2b1
and so on....
Essentially these folders are software install folders, I need to allow the users to navigate (via a DOS menu) to, say, 'Folder2b1'. Importantly the entire path with be included in the final command line, for instance:
%Folder2%\%Folder2b%\%Folder2b1%
I found an example script but I can't workout how to extend it further to include additional levels.
Sample script:
@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
set fname=%~n0
rem echo %fname%
cls
set count=1
for /D %%f in (Folder*) do (
SET Folder=%%f
echo.
echo !count! - %%f
set mis!count!=%%f
set /A count=!count!+1
)
set /A count=%count%-1
echo.
set /P input=Please select or 0 (zero) to exit [1-%count%]:
Any advice is appreciated.