Count the number of boots

You may want to count the number of times your E2B USB drive has been booted to E2B to limit the number of times it is used… 

1. Create a \_ISO\bcount.txt file containing approx 200 spaces.

2. Add these lines to the bottom of your \_ISO\MyE2B.cfg file and change the max. count from 5 to whatever number you like.

Note: use cut and paste as some lines are longer than the page width.

# ------ COUNT NUMBER OF BOOTS ----------
set bcount=0
# /_ISO/bcount.txt must exist and must initially contain 200 or more spaces
if not exist /_ISO/bcount.txt pause ERROR: \_ISO\bcount.txt does not exist! && reboot
# if bcount.txt is empty, write first lines into it
cat --locate=!BAT /_ISO/bcount.txt > nul || echo -e !BAT\nset bcount=0\n > /_ISO/bcount.txt
call /_ISO/bcount.txt > nul
# only increment if E2B is loaded (note: Ctrl+F8 will cause count to increment)
if not exist DONEMENU set /a bcount=%bcount%+1 > nul
# fill file with spaces
echo -e \x20                                                                                             \x20 > /_ISO/bcount.txt
# write batch lines to the file
echo -e !BAT\nset bcount=%bcount%\n > /_ISO/bcount.txt
if %bcount%>=5 pause ERROR: Boot count is exceeded! Press a key to reboot...
if %bcount%>=5 reboot
if not exist DONEMENU pause Boot Count is %bcount% - press a key to continue...
set bcount=

Note that if the user presses Ctrl+F8 it will increment the boot count.

You can disable the Ctrl+F8 hotkey by adding:

hotkey [Ctrl+F8]

to the end of your MyE2B.cfg file.

If testing using QEMU_MENU_TEST (run as admin).cmd then the file will not be updated when the QEMU session is ended (the file is snapshotted by QEMU). To avoid this snapshot behaviour, use QEMU F11 in RMPrepUSB.exe or use VirtualBox+VMUB.

New! Ventoy for Easy2Boot v1.0.97 now released!


eBooks available (in PDF format)

Easy-to-read eBooks are available in PDF format (each eBook is over 100 pages) – rated 4.5/5 stars.
Learn the secrets of Legacy and UEFI USB booting and then make your perfect multiboot USB drive.
E2B eBook #1 includes instructions on how to remove the E2B 5-second start-up delay blue screen.

E2B is unique in that it uses partition images which allows you to directly boot from Secure Boot images (no need to disable Secure Boot or run MOK manager or modify your UEFI BIOS).

Most eBooks are over 100 pages long, contain original content and step-by-step exercises which are suitable for both the beginner or the more experienced user.
Customer reviews are located at bottom of each eBook product page and multi-buy discounts are available when you buy more than one eBook. Please also visit and the E2B Forum.
Subscribe to my blog for the latest news, tips, USB boot articles and free eBook updates.