AutoMenu.bat: simple multi-level menu system (with a coherent help on Windows-DOS commands)
Posted: 09 Feb 2022 14:31
AutoMenu.bat is a program that implements a method to create fully working multi-level multi-option menu systems in a simple way. A menu is assembled inside a folder via three types of nodes:
- Sub-menus, defined just via sub-folders
- Command execution, defined via .bat Batch files
- Text display, defined via .txt Text files
In this way, to assemble a full "menu-tree" you just need to define subfolders at the appropriate places, create text files to display information and create Batch files to perform the final actions. The first character in subfolder and file names define both their order in the menu and the key used to select they via CHOICE command, so this character must be unique; the second character must be a hypen.
This scheme allows you to create your own menus in a very simple way. Also, this method allows to add/modify/delete menu options with no confusion about the place/level of a given option or sub-menu. In order to keep the code simpler, the program does not limit the maximum number of allowed elements in each sub-menu level nor the maximum number of characters allowed in each name. In this way, is up to you to produce the correct appareance in the final menu layout.
In addition to the AutoMenu.bat file, the .zip file also includes an extensive example of a menu system called "Windows-DOS Commands Help" that displays help descriptions about cmd.exe commands arranged in a consistent way that makes it easy to navigate. Also, several basic-level descriptions about Batch-file programming are included. I taken all this information from an old project of mine, so it includes some ancient and obsolete commands (that I want not to delete for historic reasons) and does not include a few modern ones. To open this menu, run AutoMenu.bat with the name of the folder as parameter or drag-and-drop the folder over the Batch file.
A small drawback in the scheme used is that the maximum lenght of nested names (260 characters) may be reached if you use very long names with several levels deep. If the "Windows-DOS Commands Help" menu system don't show full names or don't works correctly, try to move it to an upper level folder.
I hope you enjoy this menu system!
EDIT 2022/02/12: New version of AutoMenu.bat program
You may review the changes in this new version at this post.
Antonio
- Sub-menus, defined just via sub-folders
- Command execution, defined via .bat Batch files
- Text display, defined via .txt Text files
In this way, to assemble a full "menu-tree" you just need to define subfolders at the appropriate places, create text files to display information and create Batch files to perform the final actions. The first character in subfolder and file names define both their order in the menu and the key used to select they via CHOICE command, so this character must be unique; the second character must be a hypen.
This scheme allows you to create your own menus in a very simple way. Also, this method allows to add/modify/delete menu options with no confusion about the place/level of a given option or sub-menu. In order to keep the code simpler, the program does not limit the maximum number of allowed elements in each sub-menu level nor the maximum number of characters allowed in each name. In this way, is up to you to produce the correct appareance in the final menu layout.
In addition to the AutoMenu.bat file, the .zip file also includes an extensive example of a menu system called "Windows-DOS Commands Help" that displays help descriptions about cmd.exe commands arranged in a consistent way that makes it easy to navigate. Also, several basic-level descriptions about Batch-file programming are included. I taken all this information from an old project of mine, so it includes some ancient and obsolete commands (that I want not to delete for historic reasons) and does not include a few modern ones. To open this menu, run AutoMenu.bat with the name of the folder as parameter or drag-and-drop the folder over the Batch file.
A small drawback in the scheme used is that the maximum lenght of nested names (260 characters) may be reached if you use very long names with several levels deep. If the "Windows-DOS Commands Help" menu system don't show full names or don't works correctly, try to move it to an upper level folder.
I hope you enjoy this menu system!
EDIT 2022/02/12: New version of AutoMenu.bat program
You may review the changes in this new version at this post.
Antonio