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.