I am putting this article here so I don’t forget later. I wanted a way to erase / factory reset an ESP board I was having issues with. I Googled and read various articles and tried several methods, but this is the one that worked OK for me. I had to install Python on my Windows PC and install a command called ESPTool however but it works.
Once you have the ESPTool installed, this is the command line you run to erase the flash memory on the ESP board, whilst holding down the BOOT button on the ESP board.
python -m esptool --chip esp32 erase_flash