Hello again,
I've posted this a few days ago. But I got no response. So here is my problem again. TrustedInstaller keeps altering my "r:\Program Files" (RProg) folder that is not on the system drive. I have a "C:\Program Files" (CProg) folder that was created by Windows 7 and then upgraded to Windows 10. RProg folder has been running without any issue for years in Windows 10. But recently Windows 10 decided to change my permission every time I reboot, denying me access to my own folder and breaking dozens of applications in the process. The folder contains tons of files that I access/modify on a regular basis. I need to have full control. I cannot rename the folder, as it will affect literally over a decade worth of settings in different applications. It's not negotiable. It's my folder, not Microsofts.
Went through MS helpline but it was unsatisfactory. Solution was to rename the folder or using icacls (icacls "r:\Program Files" /grant Everyone:M). With the help of the internet, I altered it to make it work. I created this batch file:
REM __icacls "r:\Program Files\ModifiableWindowsApps" /grant Everyone:M
takeown /F "r:\Program Files\ModifiableWindowsApps" /A /R /D Y /SKIPSL >nul 2>&1
icacls "r:\Program Files\ModifiableWindowsApps" /reset
icacls "r:\Program Files\ModifiableWindowsApps" /grant:r Administrators:(OI)(CI)F /inheritance:e /Q /C /T /L >nul 2>&1
rmdir "r:\Program Files\ModifiableWindowsApps"
icacls "r:\Program Files" /q /c /t /reset
pause
It works but it takes forever as the folder contains tens of thousands of files and thousands of directories. It's not a satisfactory solution.
Please, someone must know a way of telling UnTrustedInstaller which folders it can use. I really do not know what changed to make it behave this way. Apart from updates the only new thing I installed is Minecraft from App Store, but according to settings the game is installed on default C drive. The R drive is my personal drive that contains much of my work.
Thank you for your time