Created
October 12, 2012 17:52
-
-
Save augustoproiete/3880520 to your computer and use it in GitHub Desktop.
Get access to the %ProgramFiles%\WindowsApps folder and view apps source code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@REM More info: | |
@REM http://caioproiete.net/en/get-access-to-the-programfileswindowsapps-folder-and-view-apps-source-code/ | |
@echo Backing up current folder permissions to a temporary file | |
@icacls "%ProgramFiles%\WindowsApps" /save "%TEMP%\WindowsApps.acl" /Q | |
@if ERRORLEVEL 1 goto rollback | |
@echo Assigning the ownership of the folder to the current logged user | |
@takeown /F "%ProgramFiles%\WindowsApps" | |
@if ERRORLEVEL 1 goto rollback | |
@echo Assigning full control on the folder for the current logged user | |
@icacls "%ProgramFiles%\WindowsApps" /grant "%username%":F /Q | |
@if ERRORLEVEL 1 goto rollback | |
@echo Assigning the ownership of the folder back to the "TrustedInstaller" user | |
@icacls "%ProgramFiles%\WindowsApps" /setowner "NT Service\TrustedInstaller" | |
@if ERRORLEVEL 1 goto rollback | |
@goto success | |
:rollback | |
@echo. | |
@echo Error! Rolling back... | |
@icacls "%ProgramFiles%" /restore "%TEMP%\WindowsApps.acl" /Q | |
@echo. | |
@echo Check the error messages above to see why it didn't work | |
@echo Did you forgot to run as administrator? | |
@goto end | |
:success | |
@echo. | |
@echo Success! You should have access to the "%ProgramFiles%\WindowsApps" folder | |
@goto end | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could this be adapted to a script that loops through all folders on a certain drive which disallow access?