Access denied when modifing value of registry key [run as admin & owner of key]

17,428

There is a little typo: double quote missing:

reg add "HKLM\ … \FxProperties  /f /v …
                              |<-------- here
reg add "HKLM\ … \FxProperties" /f /v …

For a wonder, reg query and reg add raise another error in case of such simple syntax mistake:

==> reg query "HKLM\SOFTWARE\Test Key /v "{testval},1"
ERROR: The system was unable to find the specified registry key or value.

==> reg query "HKLM\SOFTWARE\Test Key" /v "{testval},1"

HKEY_LOCAL_MACHINE\SOFTWARE\Test Key
    {testval},1    REG_DWORD    0x1


==> reg add "HKLM\SOFTWARE\Test Key /f /v "{testval},1"  /t REG_DWORD /d "1"
ERROR: Access is denied.

==> reg add "HKLM\SOFTWARE\Test Key" /f /v "{testval},1"  /t REG_DWORD /d "1"
The operation completed successfully.

==>
Share:
17,428

Related videos on Youtube

Tomas Bisciak
Author by

Tomas Bisciak

Java programmer ,CS bachelors degree from the University of Ss. Cyril and Methodius in Trnava. Constantly trying to improve my skills :) I welcome edits to my answers/questions.

Updated on September 18, 2022

Comments

  • Tomas Bisciak
    Tomas Bisciak over 1 year

    So i found out that i cant really modify value of the registry , whatever i do with my permissions i cant get it to work from command line (I need to do this from command line since i want to use other program to execute this) I do succeed when i try to manually change value from regedit window.

    Image

    enter image description here

    I run on windows 10 64bit , im the owner of the key with full permissions and administrator on this account.

    Any idea why i get Access denied? I cant seem to figure this out.

    Command :

    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render{d348b8e8-3118-4a9c-9b43-422647b555ca}\FxProperties /f /v "{E0A941A0-88A2-4df5-8D6B-DD20BB06E8FB},4" /t REG_DWORD /d "1"

    • DavidPostill
      DavidPostill about 8 years
      The value already exists? Have you tried deleting it first then adding it?
    • Tomas Bisciak
      Tomas Bisciak about 8 years
      @DavidPostill Value exists already, im looking to overwrite it - parameter /f forces it to overwrite , based on superuser.com/questions/607572/… .Havent tryed to delete anything, bud is that really reason to throw access denied?
    • DavidPostill
      DavidPostill about 8 years
      I know about /f. I was curious if you get the same error trying to delete it.
    • Tomas Bisciak
      Tomas Bisciak about 8 years
      @DavidPostill No idea, im scared to delete this value (cant restart this system atm) , its system value and i dont wanna mess up my audio , its value for Loudness equalization. 1 enabled , 0 disabled
    • Moab
      Moab about 8 years
      put the reg add code in a text file, then change the extension to .reg, then right click on it and select Merge, does it work?
  • Tomas Bisciak
    Tomas Bisciak about 8 years
    Yes that and one other typo i had in the key "path" was the cause i got that error, too bad the error name didnt really helped me to realize that :) thanks JosefZ.