Command line to permanently get access to folder












7















UPDATE
While I was able to use the method described in accepted answer once it failed a second time or was just giving too much trouble.



Searching further I found SetACL by Helge Klein which is far far superior and does exactly what is needed.





I cannot access certain folders e.g. c:Program FilesWindowsApps. Via command line I get an error of "Access is denied" and via Windows Explorer I get a pop up a dialog box stating "You don't currently have permission to access this folder"



enter image description here



Clicking on Continue gives me access, but I would like to grant myself access using the command line; so that my scripts do not run into this problem running under the same security context.



I found this question on Microsoft Technet but I couldn't get it to work. Note that I am already running Powershell as administrator.



PS C:WINDOWSsystem32> icacls "C:Program FilesWindowsApps" /grant i063510:F /inheritance:e
C:Program FilesWindowsApps: Access is denied.
Successfully processed 0 files; Failed processing 1 files
PS C:WINDOWSsystem32> icacls "C:Program Files" /grant i063510:F /inheritance:e
C:Program Files: Access is denied.
Successfully processed 0 files; Failed processing 1 files


If it matters, I am using Windows 10 upgraded from Windows 8.1.










share|improve this question





























    7















    UPDATE
    While I was able to use the method described in accepted answer once it failed a second time or was just giving too much trouble.



    Searching further I found SetACL by Helge Klein which is far far superior and does exactly what is needed.





    I cannot access certain folders e.g. c:Program FilesWindowsApps. Via command line I get an error of "Access is denied" and via Windows Explorer I get a pop up a dialog box stating "You don't currently have permission to access this folder"



    enter image description here



    Clicking on Continue gives me access, but I would like to grant myself access using the command line; so that my scripts do not run into this problem running under the same security context.



    I found this question on Microsoft Technet but I couldn't get it to work. Note that I am already running Powershell as administrator.



    PS C:WINDOWSsystem32> icacls "C:Program FilesWindowsApps" /grant i063510:F /inheritance:e
    C:Program FilesWindowsApps: Access is denied.
    Successfully processed 0 files; Failed processing 1 files
    PS C:WINDOWSsystem32> icacls "C:Program Files" /grant i063510:F /inheritance:e
    C:Program Files: Access is denied.
    Successfully processed 0 files; Failed processing 1 files


    If it matters, I am using Windows 10 upgraded from Windows 8.1.










    share|improve this question



























      7












      7








      7


      1






      UPDATE
      While I was able to use the method described in accepted answer once it failed a second time or was just giving too much trouble.



      Searching further I found SetACL by Helge Klein which is far far superior and does exactly what is needed.





      I cannot access certain folders e.g. c:Program FilesWindowsApps. Via command line I get an error of "Access is denied" and via Windows Explorer I get a pop up a dialog box stating "You don't currently have permission to access this folder"



      enter image description here



      Clicking on Continue gives me access, but I would like to grant myself access using the command line; so that my scripts do not run into this problem running under the same security context.



      I found this question on Microsoft Technet but I couldn't get it to work. Note that I am already running Powershell as administrator.



      PS C:WINDOWSsystem32> icacls "C:Program FilesWindowsApps" /grant i063510:F /inheritance:e
      C:Program FilesWindowsApps: Access is denied.
      Successfully processed 0 files; Failed processing 1 files
      PS C:WINDOWSsystem32> icacls "C:Program Files" /grant i063510:F /inheritance:e
      C:Program Files: Access is denied.
      Successfully processed 0 files; Failed processing 1 files


      If it matters, I am using Windows 10 upgraded from Windows 8.1.










      share|improve this question
















      UPDATE
      While I was able to use the method described in accepted answer once it failed a second time or was just giving too much trouble.



      Searching further I found SetACL by Helge Klein which is far far superior and does exactly what is needed.





      I cannot access certain folders e.g. c:Program FilesWindowsApps. Via command line I get an error of "Access is denied" and via Windows Explorer I get a pop up a dialog box stating "You don't currently have permission to access this folder"



      enter image description here



      Clicking on Continue gives me access, but I would like to grant myself access using the command line; so that my scripts do not run into this problem running under the same security context.



      I found this question on Microsoft Technet but I couldn't get it to work. Note that I am already running Powershell as administrator.



      PS C:WINDOWSsystem32> icacls "C:Program FilesWindowsApps" /grant i063510:F /inheritance:e
      C:Program FilesWindowsApps: Access is denied.
      Successfully processed 0 files; Failed processing 1 files
      PS C:WINDOWSsystem32> icacls "C:Program Files" /grant i063510:F /inheritance:e
      C:Program Files: Access is denied.
      Successfully processed 0 files; Failed processing 1 files


      If it matters, I am using Windows 10 upgraded from Windows 8.1.







      command-line windows-10 icacls






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 30 '17 at 3:23







      Miserable Variable

















      asked Jul 13 '16 at 19:47









      Miserable VariableMiserable Variable

      4102823




      4102823






















          1 Answer
          1






          active

          oldest

          votes


















          5















          You don't currently have permission to access this folder




          Try ICACLS and/or TAKEOWN with the below syntax against the folder with the username as needed.



          Try just the ICACLS commands first and if that doesn't resolve, run the TAKEOWN commands and then run the ICACLS commands again.





          ICACLS Commands





          • Grant explicit full control access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C




          • Grant explicit modify access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(M) /T /C




          • Change the owner of this folder and all beneath subfolders and files and continue on error




            ICACLS "<FolderPath>" /SETOWNER "<UserName>" /T /C






          TAKEOWN Commands





          • Run this as the account which you want to grant ownership to, and it'll be changed to the owner of the folder and all beneath subfolders and files




            TAKEOWN /F "<FolderPath>" /R /D Y








          share|improve this answer


























          • Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

            – Miserable Variable
            Jul 13 '16 at 22:13











          • Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

            – Pimp Juice IT
            Jul 13 '16 at 22:14











          • You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

            – Ramhound
            Jul 13 '16 at 22:14











          • This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

            – Miserable Variable
            Jul 13 '16 at 22:16











          • @MiserableVariable I just updated my answer with further detail as well.

            – Pimp Juice IT
            Jul 13 '16 at 23:13











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1100532%2fcommand-line-to-permanently-get-access-to-folder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5















          You don't currently have permission to access this folder




          Try ICACLS and/or TAKEOWN with the below syntax against the folder with the username as needed.



          Try just the ICACLS commands first and if that doesn't resolve, run the TAKEOWN commands and then run the ICACLS commands again.





          ICACLS Commands





          • Grant explicit full control access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C




          • Grant explicit modify access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(M) /T /C




          • Change the owner of this folder and all beneath subfolders and files and continue on error




            ICACLS "<FolderPath>" /SETOWNER "<UserName>" /T /C






          TAKEOWN Commands





          • Run this as the account which you want to grant ownership to, and it'll be changed to the owner of the folder and all beneath subfolders and files




            TAKEOWN /F "<FolderPath>" /R /D Y








          share|improve this answer


























          • Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

            – Miserable Variable
            Jul 13 '16 at 22:13











          • Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

            – Pimp Juice IT
            Jul 13 '16 at 22:14











          • You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

            – Ramhound
            Jul 13 '16 at 22:14











          • This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

            – Miserable Variable
            Jul 13 '16 at 22:16











          • @MiserableVariable I just updated my answer with further detail as well.

            – Pimp Juice IT
            Jul 13 '16 at 23:13
















          5















          You don't currently have permission to access this folder




          Try ICACLS and/or TAKEOWN with the below syntax against the folder with the username as needed.



          Try just the ICACLS commands first and if that doesn't resolve, run the TAKEOWN commands and then run the ICACLS commands again.





          ICACLS Commands





          • Grant explicit full control access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C




          • Grant explicit modify access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(M) /T /C




          • Change the owner of this folder and all beneath subfolders and files and continue on error




            ICACLS "<FolderPath>" /SETOWNER "<UserName>" /T /C






          TAKEOWN Commands





          • Run this as the account which you want to grant ownership to, and it'll be changed to the owner of the folder and all beneath subfolders and files




            TAKEOWN /F "<FolderPath>" /R /D Y








          share|improve this answer


























          • Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

            – Miserable Variable
            Jul 13 '16 at 22:13











          • Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

            – Pimp Juice IT
            Jul 13 '16 at 22:14











          • You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

            – Ramhound
            Jul 13 '16 at 22:14











          • This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

            – Miserable Variable
            Jul 13 '16 at 22:16











          • @MiserableVariable I just updated my answer with further detail as well.

            – Pimp Juice IT
            Jul 13 '16 at 23:13














          5












          5








          5








          You don't currently have permission to access this folder




          Try ICACLS and/or TAKEOWN with the below syntax against the folder with the username as needed.



          Try just the ICACLS commands first and if that doesn't resolve, run the TAKEOWN commands and then run the ICACLS commands again.





          ICACLS Commands





          • Grant explicit full control access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C




          • Grant explicit modify access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(M) /T /C




          • Change the owner of this folder and all beneath subfolders and files and continue on error




            ICACLS "<FolderPath>" /SETOWNER "<UserName>" /T /C






          TAKEOWN Commands





          • Run this as the account which you want to grant ownership to, and it'll be changed to the owner of the folder and all beneath subfolders and files




            TAKEOWN /F "<FolderPath>" /R /D Y








          share|improve this answer
















          You don't currently have permission to access this folder




          Try ICACLS and/or TAKEOWN with the below syntax against the folder with the username as needed.



          Try just the ICACLS commands first and if that doesn't resolve, run the TAKEOWN commands and then run the ICACLS commands again.





          ICACLS Commands





          • Grant explicit full control access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r <UserName>:(F) /T /C




          • Grant explicit modify access to this folder to all beneath subfolders, and files leaving all inherited permissions in place and continue on error




            ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(M) /T /C




          • Change the owner of this folder and all beneath subfolders and files and continue on error




            ICACLS "<FolderPath>" /SETOWNER "<UserName>" /T /C






          TAKEOWN Commands





          • Run this as the account which you want to grant ownership to, and it'll be changed to the owner of the folder and all beneath subfolders and files




            TAKEOWN /F "<FolderPath>" /R /D Y









          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 13 '16 at 23:12

























          answered Jul 13 '16 at 22:10









          Pimp Juice ITPimp Juice IT

          23.7k113970




          23.7k113970













          • Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

            – Miserable Variable
            Jul 13 '16 at 22:13











          • Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

            – Pimp Juice IT
            Jul 13 '16 at 22:14











          • You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

            – Ramhound
            Jul 13 '16 at 22:14











          • This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

            – Miserable Variable
            Jul 13 '16 at 22:16











          • @MiserableVariable I just updated my answer with further detail as well.

            – Pimp Juice IT
            Jul 13 '16 at 23:13



















          • Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

            – Miserable Variable
            Jul 13 '16 at 22:13











          • Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

            – Pimp Juice IT
            Jul 13 '16 at 22:14











          • You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

            – Ramhound
            Jul 13 '16 at 22:14











          • This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

            – Miserable Variable
            Jul 13 '16 at 22:16











          • @MiserableVariable I just updated my answer with further detail as well.

            – Pimp Juice IT
            Jul 13 '16 at 23:13

















          Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

          – Miserable Variable
          Jul 13 '16 at 22:13





          Thanks. I want to avoid TAKEOWN / SETOWNER. I am assuming that it changes the owner and Windows Explorer only assigns permission.

          – Miserable Variable
          Jul 13 '16 at 22:13













          Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

          – Pimp Juice IT
          Jul 13 '16 at 22:14





          Can you confirm if just the ICACLS "<FolderPath>" /INHERITANCE:e /GRANT:r "<UserName>":(OI)(CI)(X,M,F) /T /C will then give you the expected result? I'll update my answer with more detail if so.

          – Pimp Juice IT
          Jul 13 '16 at 22:14













          You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

          – Ramhound
          Jul 13 '16 at 22:14





          You have to take ownership of that folder if you want permissions to that specific folder, any other folder, you could avoid taking ownership

          – Ramhound
          Jul 13 '16 at 22:14













          This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

          – Miserable Variable
          Jul 13 '16 at 22:16





          This works for me: ICACLS "C:Program FilesWindowsApps" /INHERITANCE:e /GRANT:r i063510:F /T /C. Thanks for your help. @Ramhound I could not understand from your comment when I do or do not need to take ownership.

          – Miserable Variable
          Jul 13 '16 at 22:16













          @MiserableVariable I just updated my answer with further detail as well.

          – Pimp Juice IT
          Jul 13 '16 at 23:13





          @MiserableVariable I just updated my answer with further detail as well.

          – Pimp Juice IT
          Jul 13 '16 at 23:13


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1100532%2fcommand-line-to-permanently-get-access-to-folder%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How do I know what Microsoft account the skydrive app is syncing to?

          When does type information flow backwards in C++?

          Grease: Live!