- Many users have tried using the Registry Editor to delete certain keys, only to be met by an error message.
- The error message is the following: Cannot delete key: Error while deleting key.
- In order to fix it, try editing your Registry Key permissions, or using a third-party registry manager.
- Follow this guide if you find yourself unable to delete registry keys.
Deleting registry keys isn’t something you should usually do. However, sometimes deleting a registry key might fix a system error.
Yet, this error message might occasionally pop up when you select to delete a locked registry key:
Cannot delete key: Error while deleting key.
This is how you can fix the error while deleting key error in Windows 10 that makes you unable to delete registry key.
How do I fix the Error while deleting key issue?
- Open the Registry Editor as Administrator
- Edit the Registry Key’s Permissions
- Add RegDelNull to Windows
- Delete the Key With Registry DeleteEx
- Registrar Registry Manager to Windows
1. Open the Registry Editor as Administrator
First, note that you might need to open the Registry Editor with admin rights, otherwise you cannot delete registry keys.
To do that, press the Cortana button on the taskbar. Then enter the keyword regedit in the search box, right-click regedit and select Run as administrator.
2. Edit the Registry Key’s Permissions
Editing a registry key’s permissions will usually fix the Cannot delete key issue.
To do that, first open the Registry Editor as administrator as outlined above.
- Right-click the registry key you need to delete and select Permissions to open the window shown directly below.
- Press the Advanced button to open the window in the shot directly below.
- Click the Change link at the top of the window.
- Enter your own username in the Enter object name text box shown directly below.
- Press the Check Names button on the Select User or Group window.
- Press the OK button on the Select User or Group window.
- Select your username on the Permissions for… window.
- Select the Full Control’s Allow check box.
- Then press the Apply and OK buttons to close the window.
3. Add RegDelNull to Windows
RegDelNull is a command-line utility program with which you can delete registry keys that otherwise return the “Cannot delete key” error message.
You can save the program’s ZIP file to Windows by clicking Download RegDelNull on this website page.
Open the program’s ZIP archive in File Explorer, press the Extract all button and select a folder path to extract it to.
Click the program’s exe in the extracted folder, and open the Command Prompt. Then you can delete registry keys by entering this command:
regdelnull <key path> -s.
4. Delete the key with Registry DeleteEx
DeleteEx is an alternative program with a GUI that you can erase locked registry entries with.
Press the Download Now button on this website page to add DeleteEx to Windows. When you have the software open, you can enter the path of the registry entry to delete in a text box on the Delete Key tab.
Furthermore, you can also select to erase all the key’s subkeys. As this software includes more settings, DeleteEx might be a better program to delete registry entries with than RegDelNull.
5. Add Registrar Registry Manager to Windows
The Registrar Registry Manager is an alternative third-party registry editor for Windows. With that you can delete registry keys that you would otherwise need to adjust permissions for as outlined above.
The software also includes additional search, CLSID lookup and registry compare tools. You can add that software to Windows 10 by clicking Advanced Registry Manager on this webpage.
Then you can delete the required registry key in Registrar much the same as in the Registry Editor.
So you can fix the Cannot delete key error in Windows by adjusting the key’s permissions or by utilizing the Registrar, DeleteEx or RegDelNull software.
However, remember to back up the registry before erasing the locked registry keys. Alternatively, you can set up a restore point to roll Windows back to as covered in this post.