I started a full Windows reset on my Lenovo IdeaPad L340-15IRH because I suspected the laptop had malware. Partway through, Windows reported that it couldn't delete all the files and then began restarting repeatedly. The physical power button is broken, so I had to let the battery run down to shut it off. What's the safest way to recover the laptop and completely erase the drive?
2 Answers
Since the power button doesn’t work, check the BIOS for power-management options such as powering on when the charger is connected or temporarily disabling the internal battery. On some Lenovo models, connecting the charger can start the laptop, and disabling the battery in firmware may let you shut it down safely. BIOS options vary, so avoid changing settings unless you know what each one does.
The built-in reset feature can fail like this, especially when you choose to remove everything. The more reliable approach is to create a Windows installation USB from another computer, boot the Lenovo from it, delete the existing partitions during setup, and perform a clean installation. That will remove the old Windows installation and any malware stored on the drive, but make sure anything important is backed up first.

If you can access the boot menu or BIOS, use that to start from the Windows installation USB rather than trying the failed reset again.