DigDeep Posted May 13, 2015 Share Posted May 13, 2015 Hi,Can someone please show me a code for changing the permission level for a Registry Key.I am trying to delete a value but it is not possible as the Key permission is set as "Read Only". And I want to know a way to change the Key "Test" as Full Control.HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TEST Link to comment Share on other sites More sharing options...
jguinch Posted May 13, 2015 Share Posted May 13, 2015 This UDF should help you : https://www.autoitscript.com/forum/topic/134508-set-acl-permissions-udf/ Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
DigDeep Posted May 13, 2015 Author Share Posted May 13, 2015 ok, I needed to delete a file (Temp) inside the Key TEST and I got the command line working for thatreg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TEST" /v Temp /f"This works from the command prompt. But when I put this into code, it doesn't work. what am I doing wrong?RunWait(@ComSpec & " /c " & "reg delete " & "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TEST" & " /v Temp /f", "", @SW_HIDE) Link to comment Share on other sites More sharing options...
DigDeep Posted May 13, 2015 Author Share Posted May 13, 2015 (edited) Ok, I got this part atleast as per below... but this is still not working because of permissions issue.I checked your suggestion but not able to figure it out...RunWait(@ComSpec & " /c reg delete " & '"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TEST" /v Temp /f', "", @SW_HIDE) Edited May 13, 2015 by sunshinesmile84 Link to comment Share on other sites More sharing options...
SadBunny Posted May 14, 2015 Share Posted May 14, 2015 You need #RequireAdmin on top of your script to elevate to admin privileges:#RequireAdmin RunWait(@ComSpec & " /c reg delete " & '"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\TEST" /v Temp /f', "", @SW_HIDE)Works for me with that exact same key (and doesn't work without the directive).By the way, I suggest you change the /c to /k and the @SW_HIDE to @SW_SHOW while you are developing/testing, as the command prompt window will remain open (until you close it manually of course) and you'll be able to see the feedback. In this case either that the operation completed successfully or that it failed because access denied. Then after you get it working, change it back to hidden mode. Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
jguinch Posted May 14, 2015 Share Posted May 14, 2015 You can also use #RequireAdmin + RegDelete() Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now