Error While Deleting Key: Fix This Issue With 5 Methods

Everything you need to delete any registry key on your PC

Reading time icon 4 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

Key notes

  • 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.
error while deleting a key

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

  1. Press the Windows key and type regedit.
  2. Select Run as administrator under Registry Editor.
    regedit error while deleting a key
  3. Now, click the Yes button if you get a UAC prompt.
  4. 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.

So, you need to have administrative rights to do it.

2. Edit the Registry Key’s Permissions

  1. Follow the steps in Solution 1 to launch Registry Editor as an admin.
  2. Right-click the registry key you need to delete and select Permissions
    permissions
  3. Now, click the Advanced button.
    advanced
  4. Click the Change link at the top of the window.
    change
  5. Enter your username in the Enter object name text box.
    enetr error while deleting a key
  6. Now, click the Check Names button, followed by the OK button.check name
  7. From here, click the Apply and OK buttons on the Advanced Security page.
    apply ok
  8. Go back to the Permissions for page, click your username and check the Allow box before the Full Control option.
  9. Finally, click the Apply button, followed by OK to save the changes and try to delete the keys again.
    full error while deleting a key

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

  1. Download the RegDelNull zip file.
  2. Open Downloads and right-click the zip file, and select Extract files..
    edit
  3. Now, open the extracted folder and double-click the exe file there.
  4. 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

  1. Download and install PSExec.
  2. Press the Windows key, type cmd, and click Run as administrator under Command Prompt.
    cmd admin
  3. Now, type the command below and hit Enter: psexec -i -d -s c:\windows\regedit.exepsexec  error while deleting a key
  4. This will now open the Registry Editor. Ensure that you don’t have any prior window of Regedit open.
  5. 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.

More about the topics: error, windows 10, windows registry

User forum

3 messages