- If you are getting an error while trying to delete a registry on your PC, it might be because you don't have the necessary permissions.
- Try editing your Registry key permissions or using a third-party registry manager to fix this issue.
- Another effective and easy solution is to use the RegDelNull file from Sysinternal.
Deleting and editing registry keys isn’t something you should usually do. However, sometimes it is needed to fix a system error.
Yet, some users are met with Cannot delete key: Error while deleting key prompt while trying to delete a locked registry key. This guide will show you how to fix this error on your PC.
Why can I not delete the registry key?
The reasons you are getting an error while deleting a key on Regedit are not far-off. Below are two major ones:
- Lack of permission: Registry keys are treated like files and folders on your PC. So, if Windows 10 is showing an error while deleting a key, it might be because you don’t have permission to delete them. So, the solution here is to take ownership of the keys and try to delete them again.
- Presence of null characters: If the key you are trying to delete contains null keys, you might be unable to delete all specified values. You can fix this by adding RegDelNull to your PC.
How do I fix the Error while deleting key issues?
1. Open the Registry Editor as Administrator
- Press the Windows key and type regedit.
- Select Run as administrator under Registry Editor.
- Now, click the Yes button if you get a UAC prompt.
- Finally, try to delete the keys again.
The first thing to do if you are getting an error while deleting a registry key is to run Registry Editor as an admin. This is because your PC considers registry key deletion highly privileged.
How we test, review and rate?
We have worked for the past 6 months on building a new review system on how we produce content. Using it, we have subsequently redone most of our articles to provide actual hands-on expertise on the guides we made.
For more details you can read how we test, review, and rate at WindowsReport.
So, you need to have administrative rights to do it.
2. Edit the Registry Key’s Permissions
- Follow the steps in Solution 1 to launch Registry Editor as an admin.
- Right-click the registry key you need to delete and select Permissions…
- Now, click the Advanced button.
- Click the Change link at the top of the window.
- Enter your username in the Enter object name text box.
- Now, click the Check Names button, followed by the OK button.
- From here, click the Apply and OK buttons on the Advanced Security page.
- Go back to the Permissions for page, click your username and check the Allow box before the Full Control option.
- Finally, click the Apply button, followed by OK to save the changes and try to delete the keys again.
If you are getting an error while deleting a registry key, it might be because you don’t have ownership of the key. Following the steps above will give you full control of the keys.
3. Add RegDelNull to Windows
- Download the RegDelNull zip file.
- Open Downloads and right-click the zip file, and select Extract files..
- Now, open the extracted folder and double-click the exe file there.
- Finally, enter the command (replace the key path with the path of the registry key you want to delete ) below and hit Enter:
regdelnull <key path> -s
Another possible reason you are getting an error while deleting a key is the activities of the null characters in the key. The RegDelNull will help replace these null characters and help you delete the key easily.
4. Use PSExec
- Download and install PSExec.
- Press the Windows key, type cmd, and click Run as administrator under Command Prompt.
- Now, type the command below and hit Enter:
psexec -i -d -s c:\windows\regedit.exe
- This will now open the Registry Editor. Ensure that you don’t have any prior window of Regedit open.
- Finally, try deleting the keys again.
If you still get an error while trying to delete a registry key after changing the permission, you need to use PSExec. This has proved effective for many users. So, you should try it too.
5. Delete the key with Registry DeleteEx
If all the solutions above prove futile in fixing the error while deleting a key prompt, you might need to try an alternative.
One effective program that users have found joy in using is DeleteEx. This tool has a GUI that you can erase locked registry entries.
Furthermore, you can also select to erase all the key’s subkeys. As this software includes more settings, DeleteEx might be a better program for deleting registry entries with than
There you have it: Everything you need to fix the error deleting a key prompt in Windows. Just make sure you follow the instructions carefully, and you should be able to delete your registry keys again.
If you made a mistake and want to know how to undo changes on Registry Editor, check our detailed guide to do it quickly.
Feel free to let us know the solution that worked for you in the comments below.