So the problem is im trying to delete some reqistry keys (startup items) via commandline and while i can delete from HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run just fine i cannot delete anything from HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
I even created some temporary keys there trough regedit.exe but even those are undeletable via commandline. So i searched trough similar threads here and obviously googled it. Usually this happens because:
- Command promt is not run as administrator. Thats not the case here as i defenetly have administrator rights within the launched cmd window.
- Registry permissions are blocking deletion. Again not the case here. I manually changed permission trough regedit.exe and om now the owner of HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run along with full control for my aacount.
The specific error message given by commandline is:
ERROR: The system was unable to find the specified registry key or value.
Yet the key defenetly exists in the location where im trying to delete it from and even regedit shows its there. I can also delete it with regedit without a problem.
Anyone have any clues as what to check?
EDIT: Ok so while writing this post i stumbled upon something really bizarre. It would appear that there are two versions of HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
I have no idea hows this even possible but when i copy the key name in regedit they are both identical and yet they display different items. The first one is ok and it seems reg.exe is trying to find and delete the key in this location and thats why it errors out. The second one is the problematic one where the key exists that i need to delete via commandline.
However when i add an identical key to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run it gets written to the "correct" location and i can also delete it via commandline.
EDIT 2: Ok ithink i know what the problem is now. The "correct" location is displayed when i ren native 64bit version of regedit and the problematic one is only displayed when i run 32bit version of regedit.
SOLUTION: Use %windir%\SysWOW64\reg.exe to manipulate 32bit registry entries and %windir%\System32\reg.exe to manipulate 64bit registry entries. Im going to have a stern talk with the program authors tho about why they shove their startup key into 32bit reqistry on a 64bit system.
So...yeah. No help needed but i figure i might as well post this anyway. It could help someone save alot of trouble in the future.