One day, you look in your D Drive and see two extra folders:
- Program Files (with ModifiableWindowsApps inside)
Program Files is owned by
Services and WindowsApps is owned by
TrustedInstaller. Attempting to delete these folders will throw an error, even as an administrator.
What’s odd is that these folders can appear on the largest secondary drive instead of where you would expect them – the C drive. Other users have reported seeing these folders on multiple secondary drives.
How to Remove Program Files and WindowsApps From Your D Drive
The first thing I’ll say is that you can remove these folders. On reboot, they could come back depending on what you have installed. More on this below. For now, here’s the procedure to remove these folders.
- Open a Command Prompt with administrative privileges.
- Run following commands, one at a time:
takeown /F "D:\Program Files" /A /R /D Y
icacls "D:\Program Files" /T /grant administrators:F
rd /s /q "D:\Program Files"
takeown /F "D:\WindowsApps" /A /R /D Y
icacls "D:\WindowsApps" /T /grant administrators:F
rd /s /q "D:\WindowsApps"
Commands Explanation and Documentation
DACLs identify the trustees that are allowed or denied access to a securable object. System groups are only able to modify these folders. So simply giving ownership to the folder might not be enough. You will need to grant permission in the DACLs. For more information, check out Microsoft’s Access Control Lists and DACLs explained help doc.
- takeown – Administrator recovers access to directories and its content that previously was denied, by making the administrators group the owner.
- /F [directory] – specifies which directory.
- /A – gives ownership to administrators group.
- /R – performs it as recursive operation on directory, all files and sub-directories.
- /D – suppresses confirmation prompts when user does not have “List Folder” permission when following the Y option to take ownership of the directory.
- Note: The Y option may be different depending on OS language.
- icacls – Grants the administrators group full access DAC permissions to directory.
- [directory] – specify which directory.
- /T – performs the operation on all specified files in directory and sub-directories.
- /grant – grants specified user access rights with :F, which gives full access.
- Note: The group name administrators may be different depending on OS language.
- Note 2: Use
caclsfor older versions of Windows.
- rd – Deletes the directory with all its sub-directories and files.
- /s – deletes the specified directory and its sub-directories including all files.
- /q – specifies quiet mode so you get no prompt for confirmation
- [directory] – specify which directory to delete.
- Note: Use
rmdirfor older versions of Windows.
What to Do if You Have a Windows Folder in Your D Drive
The following is a simple solution from this suggestion in Microsoft Answers:
- Rename the Windows folder to Windows.old.
- Run Disk Cleanup from the Start menu.
- Select the drive containing the Windows.old folder.
- Tick previous “Windows Installation(s)” then click on OK.
What Are These Folders and Where Did They Come From? What Would Make Them Come Back?
What are these folders used for? Why do they appear on non-primary drives? Are they safe to delete and why do permissions and ownership need to change to do so?
The ‘ModifableWindowsApps’ folder may contain installation files that would allow users to install mods for games. The function is intended to be used by certain types of PC games and developers can specify one or more subfolders for their games.According to UWP guidelines document
Basically, if you install a game from the Windows 10 Store or use Xbox Game Pass, you can expect to see these folders, whether you move your games to your D drive or not.
The Microsoft Document Contains Further Details
Specifies a folder under the
%ProgramFiles%\ModifiableWindowsAppspath where the contents of your desktop application’s install folder are projected so that users can modify the installation files (for example, to install mods). This element is currently intended to be used only by certain types desktop of PC games that are published by Microsoft and our partners.
These folders would be created when certain Microsoft games are installed. If you remove the folders with the procedure above and the games are still installed on the system, they will come back. They can only truly be removed when you uninstall the Microsoft games.
These folders do not hurt anything as they are legitimate folders. They can be left alone even though they can be an eyesore if you like your drives and folders to have a clean, minimum folder structure.
This modding feature is still in development so there may be more control added in the future.