Add a new sub-menu
The Main Menu contains various sub-menus, e.g. LINUX, ANTIVIRUS,etc. The sub-menu entry will only appear in the Main Menu if there are files inside the sub-menu folder. We can add our more sub-menu folders (e.g. MSDART) into the Main Menu.
Note: All Menu folders must be directly under \_ISO and the folder name must not contain spaces or special characters. Do NOT edit/change any of the existing E2B files.
E2B SUBMENU Maker.cmd
Assuming you want to add a new sub-menu for say MSDART…
An easy way to add a new Main Menu entry for a new folder, is to use the \_ISO\E2B SUBMENU Maker.cmd file – just run this or drag-and-drop your new \_ISO\MSDART folder onto it, to make a Main menu entry for it.
You can edit the new file using NotePad afterwards (save as UTF-8 to preserve any special characters if using a non-English language).
Watch the YouTube video above or read the Blog for more details.
Note: If the new menu folder is completely empty, then there will be no menu entry for it in the Main menu – you must copy an ISO or .mnu file, etc. into the new sub-folder before the menu entry will be displayed.
ADMIN Menus (secret and password protected menu folders)
You can edit the .mnu file so that the sub-menu entry is only displayed under certain conditions.
For instance, in the example below, if the SCROLL LOCK LED is on, then an ADMIN Menu entry will be displayed in the Main Menu.
1. Use the E2B SUBMENU Maker to make a \_ISO\ADMIN folder and a new ZZSubMenu$ADMIN.mnu file as detailed above.
2. Edit the iftitle line in the new \_ISO\MAINMENU\ZZSubMenu$ADMIN.mnu file as shown below (the extra text to add is shown in red):
#Check 0x40 for CAPS LOCK on - use 0x20 for NUM-LOCK or 0x10 for SCROLL-LOCK, 0x08 for ALT, 0x04 for CTRL iftitle [calc *0x417 & 0x10 > nul && ls (bd)/_ISO/ADMIN/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] ^Alt+A ADMIN Menu [Alt+A]\nThis menu is only visible in Admin mode. set MFOLDER=/_ISO/ADMIN set HDG=Admin Menu (bd)/%grub%/SubMenu.g4b boot
This example will only display the Admin menu entry in the Main Menu when SCROLL-LOCK is on.
Whenever the Main Menu is loaded, the status of the keyboard will be checked.
You can change the 0x10 number to test for CAPS LOCK or NUM LOCK or the ALT or CTRL keys being held down. Note that some systems will turn on NUM LOCK when they boot.
0x02 for L-SHIFT, 0x01 for R-SHIFT can also be used, but you must not hold down the SHIFT key until just before the Main Menu starts to load, otherwise the grub4dos USB 2 driver will be loaded because E2B checks for the SHIFT keys at an early stage.
If using CTRL or ALT or SHIFT, you must press F8 first and then hold down the special key just before the Main Menu is loaded.
You can create more sub-menus in the same way if you wish, so that many extra menus will be visible in the MAIN MENU when the secret key is activated.
You can request a password before a sub-menu will be loaded by adding the line:
password fred || configfile (md)0xA000+0xA0
just below the iftitle line.
Change ‘fred’ to your own password or use %pwd% to use the E2B menu password.
Manually add a new sub-menu
Let us suppose we want a new menu folder called ‘MSDaRT’ for our MSDart ISOs (this could hold XP-based, Vista/7/8 based or UEFI .imgPTN files – see blog). We want this new menu to be listed in the Main menu as a SubMenu.
1. Make a new folder at \_ISO\MSDART and put an ISO in it (or whatever payload files you want). If you want to add payload files + .mnu files to it, make a \_ISO\MSDART\MNU folder (any name will do!) and put your .mnu files + payload files in there.
2. Create a new text file \_ISO\MAINMENU\ZZSubMenu$MSDART.mnu from the WINPE example menu below (actually the name of your new .mnu file is not important, but it’s name will determine the order it appears in the Main menu – so to have it appear before the other menu entries call it $$SubMenuMSDART.mnu – to have it appear last, call it ZZZZSubMenuMSDART.mnu).
3. Edit the new .mnu file and change ‘WINPE’ to ‘MSDART’ and all the other text shown below in bold text. Choose a new hotkey letter (or delete the ^Ctrl+W text) and a new heading for the menu.
IMPORTANT: Ensure that the ‘set MFOLDER=…..’ line does not end with a SPACE character as this may cause problems (e.g. loading wallpaper files, etc.).
This is for non-GFXBoot Menu E2B configurations as it uses a menu hotkey (CTRL+W) – hotkeys do not work in GFXBoot Menus.
iftitle [ls (bd)/_ISO/WINPE/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul && if "%GFX%"==""] ^Ctrl+W WINPE Menu [Ctrl+W]\n Bootable WinPE's #MFOLDER must be the full folder path starting with / set MFOLDER=/_ISO/WINPE #HDG is the top heading for the menu - \x20 is the code for a single SPACE character set HDG=\x20WinPE Menu \x20 (bd)/%grub%/SubMenu.g4b boot
Look at \_ISO\MAINMENU\ZZSubMenuAll.mnu for other examples (but DO NOT edit it!). Ensure you save it as UTF-8 encoded if you use non-ASCII characters (use NotePad- File – Save As…).
Add new ‘AUTO’ Payload folders
The \_ISO\AUTO folder can be used to hold many folders containg many payloads files. All the payload files in all the sub-folders will be collected into one ‘DIRECT BOOT’ menu. If you want to add more menu folders that work like the \_ISO\AUTO folder, then create a .mnu text file in the \_ISO\MAINMENU folder and use this format:
The folders do not have to be below /_ISO, but this example uses \_ISO\LinuxISO\Ubuntu and \_ISO\LinuxISO\Fedora to hold Ubuntu and Fedora payload files…
iftitle [if "%GFX%"=="" && ls (bd)/_ISO/LinuxISO/Ubuntu > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Ubuntu Menu\n Go to Ubuntu Menu set LBACKMENU=(bd)/%grub%/menu.lst set HDG=\x20 Ubuntu Menu (bd)/%grub%/QAUTO.g4b .automenu /_ISO/LinuxISO/Ubuntu debug 0 configfile (md)0x3000+0xA0 iftitle [if "%GFX%"=="" && ls (bd)/_ISO/LinuxISO/Fedora > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Fedora Menu\n Go to Fedora Menu set LBACKMENU=(bd)/%grub%/menu.lst set HDG=\x20 Fedora Menu (bd)/%grub%/QAUTO.g4b .automenu /_ISO/LinuxISO/Fedora debug 0 configfile (md)0x3000+0xA0
Note that QAUTO.g4b will enumerate ALL payload files in all folders below the specified folder, so you cannot have nested folders.
Enumerate only one folder
If you only want the menu to list payload files that are in one folder and not search below that folder, then set the LEVEL1 parameter – e.g.
Example folder structure:
- /_ISO/Ubuntu – use for main ISOs
- /_ISO/Ubuntu/Version13 – for released v13 ISOs
- /_ISO/Ubuntu/Version13/TESTONLY – used for test builds of Ubuntu v13
iftitle [ls (bd)/_ISO/Ubuntu > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Main Ubuntu ISOs\n List Main Ubuntu ISO only set LBACKMENU=(bd)/%grub%/menu.lst set HDG=\x20 Ubuntu Menu set LEVEL1=YES (bd)/%grub%/QAUTO.g4b .automenu /_ISO/Ubuntu set LEVEL1= debug 0 configfile (md)0x3000+0xA0 iftitle [ls (bd)/_ISO/Ubuntu/Version13 > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Ubuntu v13 Menu\n Go to Ubuntu v13 menu set LBACKMENU=(bd)/%grub%/menu.lst set HDG=\x20 Ubuntu v13 Menu set LEVEL1=YES (bd)/%grub%/QAUTO.g4b .automenu /_ISO/Ubuntu/Version13 set LEVEL1= debug 0 configfile (md)0x3000+0xA0 iftitle [ls (bd)/_ISO/Ubuntu/Version13/TESTONLY > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] Ubuntu v143 Test ISOs\n Go to Ubuntu v13 TEST menu set LBACKMENU=(bd)/%grub%/menu.lst set HDG=\x20 Ubuntu v13 TEST Menu set LEVEL1=YES (bd)/%grub%/QAUTO.g4b .automenu /_ISO/Ubuntu/Version13/TESTONLY set LEVEL1= debug 0 configfile (md)0x3000+0xA0
Add a sub-sub-menu folder
The \_ISO\UTILITIES_MEMTEST folder is actually a sub-sub-menu folder for the Memory Test menu which can only be reached via the Utilities menu.
The \_ISO\UTILITIES\Utilities_MemTest.mnu file is used to add a menu item in the Utilities Menu which will take you to the UTILITIES_MEMTEST menu.
In the UTILITIES_MEMTEST folder there is a ZZBackTo_Utils.mnu file which will take you back to the Utilities Menu from the Memory Test menu.
New in v1.62:
An easy way to add a new Main Menu entry for a folder is to use the \_ISO\docs\E2B Utilities\Make SubMenu.cmd file – just run this or drag-and-drop your new \_ISO\MSDART folder onto it, to make a Main menu entry for it. See the Blog for more details.
Otherwise, do it the hard way and follow the steps below.
If you want your own sub-sub-menu, then you will need to create two similar files…
Example for Linux – Ubuntu sub-sub-menu
You want a new UBUNTU sub-sub-menu in the Linux Menu for Ubuntu ISOs
1. Use the \_ISO\docs\E2B Utilities\E2B SUBMENU Maker.cmd to create a LINUX_UBUNTU folder
Yoy can specify a hotkey (e.g. Ctrl+U) if you wish.
2. Move the file created in the \_ISO\MAINMENU folder (ZZSubMenu$LINUX_UBUNTU.mnu) to the \_ISO\LINUX folder
3. Copy your Ubuntu ISO files into the new, empty \_ISO\LINUX_UBUNTU folder
4. You can now test your menu, but you can only go back to the Main menu using F8.
To return to the LINUX menu from the LINUX_UBUNTU menu, add a new \_ISO\LINUX_UBUNTU\ZZReturn.mnu file:
title Return to Linux Menu\n Go back to the previous menu set MFOLDER=/_ISO/LINUX set HDG=Linux Menu #HDG will be the heading for the menu (bd)/%grub%/SubMenu.g4b boot
You can define a hotkey too, by using a different title line, e.g.
title ^Ctrl+F9 Return to Linux Menu [Ctrl+F9]\n Go back to the previous menu
*Ctrl+F9 should now be used because Ctrl+F8 will now reload E2B in later versions!
To change the order of the menu entries, start the .mnu file name with either $ or ZZZZ as files are sorted alphabetically (the actual name of .mnu files does not matter).
You can edit the new .mnu files if you wish to change them (if you edit existing E2B .mnu files, they will be overwritten when you next update E2B!).
Multiple ‘nested’ menus
You can make a series of new ‘nested’ menus using the same technique as detailed above. Note that all the new menu folders must be directly under the \_ISO folder – you must not place one folder inside another folder (do not nest menu folders).
Password protect a sub-menu
If you only want to allow users to access a sub-menu if they know a password, you can just create a new folder and then make a new .mnu file which will load that new folder as an E2B menu folder.
The new folder could contain payload files and/or .mnu files.
# Example to password protect a sub-menu # menu folder is \_ISO\E2B_SETTINGS in this example # password is "E2B" - you could use %pwd% or %menupwd% or a different variable instead iftitle [ls (bd)/_ISO/E2B_SETTINGS/ > (md)0x9F00+1 && checkrange 1:-1 read 0x13E0000 > nul] ^Ctrl+S E2B Settings Menu [Ctrl+S]\nSettings menu (password protected) echo -e -n \nThis menu is password protected.\nPlease enter the correct password now... echo echo !BAT > (md)0x300+1 echo -e password E2B \|\| configfile (md)0x3000+0xA0 >> (md)0x300+1 #display batch file for debug #raw cat --hex (md)0x300+1 ;; pause call (md)0x300+1 # set menu folder and menu heading set MFOLDER=/_ISO/E2B_SETTINGS set HDG=E2B SETTINGS MENU clear # load the new submenu (bd)/%grub%/SubMenu.g4b boot