Lately, I've been quite annoyed at the fact that I can't edit files in C:\Program Files\WindowsApps folder. I've used the takedown command, in elevated CMD, and changed permissions, to allow admins to have full control (I am an admin), and changed owner to Administrators. I can delete files/folders, yet, whenever I try to edit files, or add files, I get the error message "Access is denied." How do I enable creating files and editing files in WindowsApps?
7 Answers
The WindowsApps folder is one of the most heavily protected folders in Windows 10. It contains all the Windows UWP apps, to which Microsoft zealously guards the access.
The protections on this folder may change across Windows versions.
The usual methods of taking ownership and assigning permissions are not enough for this folder, but are still required as first step to gaining access. After executing them, accessing the folder is now possible for copying, but editing is still blocked. To edit, one needs to save the file elsewhere, and only then replace the original with the edited version.
A further note is that restoring the ownership of the folder to TrustedInstaller
is possible without losing the extra permissions that were assigned,
by using the command:
icacls "%ProgramFiles%\WindowsApps" /setowner "NT Service\TrustedInstaller" /t
If someone wishes to use an elevated Command Prompt for gaining access to the folder, then these are the commands :
takeown /F "%ProgramFiles%\WindowsApps"
takeown /F "%ProgramFiles%\WindowsApps" /r /d y
icacls "%ProgramFiles%\WindowsApps" /grant Administrators:F
icacls "%ProgramFiles%\WindowsApps" /grant Administrators:F /t
I also note that permission problems can be avoided by using the following commands before and after changing permissions to completely restore the original permissions :
icacls "%ProgramFiles%\WindowsApps" /save WindowsApps.acl
icacls "%ProgramFiles%" /restore WindowsApps.acl
To complement the poster's remark about restoring the original permissions on the folder while not having saved these permissions before starting, this is done by entering in an elevated Command Prompt (cmd) the command :
icacls "%ProgramFiles%\WindowsApps" /q /c /t /reset
If the command does not work, it needs to be redone from a Windows boot CD/USB, as explained in the post Reset default ACLs for C:\Program Files\WindowsApps:
- Follow the instructions on this page to create the Windows Installation Media
- Boot from the USB/CD, click "Repair my computer" upon reaching the Install button
- Select Troubleshoot, then Command Prompt
- Your current drive
C:will be the boot media, with your Windows system disk likely inD:, so verify usingdir D:, and if not, then search for the right drive-letter Using the drive letter you just found (maybe
D:\), issue the command:icacls "D:\Program Files\WindowsApps" /q /c /t /resetWait for the operation to complete, and check the output for errors
- Reboot.
- 498,455
Level of difficulty [extremely advanced].
On Win 10 (almost latest version), I read Harry’s original post and chose to start with the backup:
Click Start
Type “cmd” and wait, don’t hit enter yet.
Click “run as administrator”
Type:
cd \Progra~1 and hit enterBackup permissions:
icacls "%ProgramFiles%\WindowsApps" /save WindowsApps.acl
I then continued with Harry’s guidance:
[Still]...an elevated Command Prompt for gaining access to the folder (but for grant I started with just my App, which had special settings it wanted me to update for EyeTV 64-bit):
takeown /F "%ProgramFiles%\WindowsApps"
takeown /F "%ProgramFiles%\WindowsApps" /r /d y
icacls "%ProgramFiles%\WindowsApps\GENIA...<-your App name" /grant Administrators:F
icacls "%ProgramFiles%\WindowsApps\GENIA...<-your App name" /grant Administrators:F /t
I was conservative I changed view settings: Select View > Options > Change folder and search options. Select the View tab and, in Advanced settings, select Show hidden files, folders, and drives and OK.
I then followed Albin’s post above to get more control and remove inheritance (not completely, but make it individual) on WindowsApps:
![Albin’s post images]
I now right click WindowsApps folder in C:\Program Files and unhide and uncheck read only.
Also gave myself, Admin, Full Control see Albin for permissions, and Apply
Then at elevated cmd:
icacls "file" /setowner "NT Service\\TrustedInstaller" /T /C
I went to my Genia folder in WindowsApps and copied the file I wanted to desktop, edited it and copied it back to just the Program Files folder (with Administrator confirmation).
Back in elevated command prompt I deleted the old file I wanted to change:
del “filename.ini”.
Then I got Linus Torvalds Git app for windows, from wikipedia
I Installed git-bash, then ran that “right-click” as administrator.
Copied the file using that and got a 0 byte empty file and error, but it did not break my apps, and proved write capability.
I got Ubuntu 12 and used Rufus in Freedos/mbr mode to make a bootable USB from Ubuntu AMD 64 or 32 iso, and BIOS boot to my UEFI USB.
In test mode I used The folder icon > Win10 “whatever your disk is called” to mount my drive.
In logo icon (top left), search terminal, click and navigate via:
cd /media/Win10/Program\ Files > enter
cat filename.ini > WindowsApps/GENIA.../Transponders/filename.ini
I unmounted (ejected) Win10 back in folder view.
Shutdown (top right button), reboot.
Wait for dots about ten times.
Remove USB when prompted, hit Enter.
Test it out in Windows.
My App now works right, with settings updated.
I tried elevated cmd prompt:
icalcs %ProgramFiles% /restore WindowsApps.acl
No success, so I did:
icacls "%ProgramFiles%\WindowsApps" /q /c /t /reset
I then followed Albin’s post above to remove control and inheritance on WindowsApps:
![Albin’s post images]
Even though it was there, Made myself owner again. I Added Administrators > check Names.
Added new user permission, check names;
Gave myself just read & execute, list folder contents, read on a second Administrator entry;
And deleted full control entry for me.
I changed owner back
NT Service\TrustedInstaller > check names
Becomes TrustedInstaller
I then hit apply and close out.
My apps still work.
- 2,337
- 49
- 3
I have solved this myself nonetheless:
From an administrator command prompt the following command will copy the WindowsApps package folder (or any folder within):
robocopy /B /E /COPY:DAT D:\WindowsApps\xxx D:\MyTargetDir
This will copy the WindowsApps\xxx package folder on D:\ to MyTargetDir folder on D:\. This works because the /B option tells Windows to use the Backup token which ignores any permissions or limitations / policies.
After that the files need to be decrypted:
cipher /D /S:D:\MyTargetDir
Then the files can be edited.
Remove the original folder (or rename it):
mv D:\WindowsApps\xxx D:\WindowsApps\xxx_
And then copy back the edited files:
robocopy /B /E /COPY:DAT D:\MyTargetDir D:\WindowsApps\xxx
HOWEVER: Note, I still haven't figured out how to make the edited app start, as for now Windows Store will return errors for the apps in these folders as soon as the permissions are changed. Changing them back won't work.
- 1,999
There is a solution: you have to change the ownership of the files/folders. Here you can see the description including screenshots (there's already a copy on superuser as well). I just tried it on Win10 Creating/Editing/Deleting Files is possible.
If you want to reverse the ownership change you can find a description here. After changing it back you're user will still have access to the folder, removing all other security changes (like changed permissions) that were made during the ownership change will fix that to it's original state.
Important: In some cases the Store (or the Apps) wont function after changing the ownership and changing it back, unless you remove "all" changes not just the ownership. So make sure to create a system restore point unless you know exactly what you are doing!
Here's a copy of the description to change the ownership:
Type in
C:\Program Files\WindowsAppsin the Windows Explorer address bar and hit enter.
Observe in shock and dismay the system dialog saying you don’t own a folder on your own machine. Hit "Continue."

After hitting "Continue," you’ll be confronted by the following dialog:

Do not hit "Close"—instead click the "security tab" link.
In the following system dialog click "Advanced."

Click the "Change" link in the owner security field.

Add in your Live ID or Windows 8 user name to the "Select User or Group" system dialog.

Click "OK," "OK," and "OK."

- 11,950
I've tested all solution to edit file for Age of Empire IV, even the linux one ! But it doesn't work, the directory is corrupted ... we can just move it to the trash :/
I've seen and tried many ways, but only one method has never disappointed me until now: MoveFileEx with the flag MOVEFILE_DELAY_UNTIL_REBOOT. It executes the copy operation early during the next reboot.
If you don't want to write a program (C++, C#), you can do it with a PowerShell script. For example, to copy "test.txt" from C:\temp into MSPaint's WindowsApp directory:
Add-Type -TypeDefinition @"
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
public static class MyKernel32
{
[DllImport("kernel32.dll", CharSet=CharSet.Unicode)]
public static extern bool MoveFileEx(
String lpExistingFileName,
String lpNewFileName,
uint dwFlags);
}
"@
[MyKernel32]::MoveFileEx("C:\Temp\test.txt", "C:\Program Files\WindowsApps\Microsoft.MSPaint_2022.2203.1037.0_neutral_~_8wekyb3d8bbwe\test.txt", 5)
This will schedule the "move" operation for the next reboot.
Pay attention to the following:
- Since this is a "move" operation, the file will really be moved, meaning it will no longer exist in C:\temp.
- MoveFileEx cannot work across drives. Both paths (source and target) must be located on the same drive (maybe even on the same partition, I'm not sure)
Deleting files from WindowsApps directory seems to be easier. It can usually be done from Windows Explorer started as administrator. Or use Sysinternal's psexec to start a DOS-prompt under System-account:
psexec -s cmd.exe
This also gives you a lot of power. But unfortunately, usually not enough to simply use the "copy" command.
- 1
I found a simple solution, after try a lot of things, I discover a problem in the folder name (special character like ~), try rename the main app folder to a simple name like "folder1" (save the original name in notepad before), copy or replace the files and come back the main app name folder to original name.
Other thing, look if windows "LongPath" register is enabled, why sometimes subfolder have more than 255 characters
- 1
- 1