Can't delete registry key Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
user549
Posts: 7
Joined: 23 Jan 2019, 04:30

Can't delete registry key

29 Aug 2019, 03:18

I am on Windows 10 64 bit. I can't delete this registry key though i can manually delete it using Regedit.exe. This is the code:

Code: Select all

RegDelete, HKEY_CLASSES_ROOT\MbHwgGGS1
Please help. Thanks.
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Can't delete registry key

30 Aug 2019, 02:40

Did you try to run the script 'as admin' ? I could imagine that deleting registry keys requires elevated rights on most systems...
user549
Posts: 7
Joined: 23 Jan 2019, 04:30

Re: Can't delete registry key

31 Aug 2019, 04:08

Yes, I did. But it did not work.

It seems the script can delete the keys under HKEY_CURRENT_USER branch only.

Any ideas? Thanks.
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Can't delete registry key

31 Aug 2019, 04:25

According to the RegDelete docs, HKEY_CLASSES_ROOT keys should generally be accessible/deletable.

I would add these lines immediately after your RegDelete attempt:

Code: Select all

msgbox % ErrorLevel
msgbox % A_LastError
Errorlevel is probably 1 in your case, but the A_LastError might give you some error code that you (or we) might be able to decode with the help of the Microsoft docs on the internet. Ideally, you can then take countermeasures, depending on the actual problem.

Since you are on a 64-bit system, this might be an issue:
To delete entries from the 64-bit sections of the registry in a 32-bit script or vice versa, use SetRegView.
user549
Posts: 7
Joined: 23 Jan 2019, 04:30

Re: Can't delete registry key

31 Aug 2019, 06:43

I tried this:

Code: Select all

SetRegView 32
;SetRegView 64
RegDelete, HKEY_CLASSES_ROOT\MbHwgGGS1
msgbox % ErrorLevel
msgbox % A_LastError
I still see the ErrorLevel is 1, A_LastError is 5 (ERROR_ACCESS_DENIED, according to this https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-)

What should I do now? Thanks.
gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Can't delete registry key

31 Aug 2019, 07:30

Are there subkeys? It seems that in some cases you need to delete all subkeys before you can delete the main key.
There is Loop (Registry) to loop through keys. (Again try also as admin.)
user549
Posts: 7
Joined: 23 Jan 2019, 04:30

Re: Can't delete registry key  Topic is solved

31 Aug 2019, 08:52

Thanks for your help.

I reinstall Autohotkey. Certainly, must run the script as Admin for it to work, there is no need to use SetRegView.

Thanks, again, gregster and the others for your help.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 178 guests