Why can't I edit a "Program Files" file on Windows 7?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Digital Sunset Looping
--
Chapters
00:00 Why Can'T I Edit A &Quot;Program Files&Quot; File On Windows 7?
01:03 Accepted Answer Score 36
02:46 Answer 2 Score 13
03:43 Answer 3 Score 0
04:22 Thank you
--
Full question
https://superuser.com/questions/384107/w...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows7 #filepermissions
#avk47
ACCEPTED ANSWER
Score 36
Due to security features introduced with Windows Vista (UAC) any non-Administrator program that tries to write to protected locations such as "Program Files" will get their writes caught and redirected to an alternative "user friendly" location.
The program that made the file will be able to see the file, but most other programs will not.
Wikipedia states (and I've highlighted the relevant section):
Applications written with the assumption that the user will be running with administrator privileges experienced problems in earlier versions of Windows when run from limited user accounts, often because they attempted to write to machine-wide or system directories (such as Program Files) or registry keys (notably HKLM). UAC attempts to alleviate this using File and Registry Virtualization, which redirects writes (and subsequent reads) to a per-user location within the user’s profile. For example, if an application attempts to write to “C:\program files\appname\settings.ini” and the user doesn’t have permissions to write to that directory, the write will get redirected to “C:\Users\username\AppData\Local\VirtualStore\Program Files\appname\settings.ini”.
So in theory your changed file is actually being written to C:\Users\YourUserName\AppData\Local\VirtualStore\Program Files (x86)\CMake 2.8.7\share\cmake-2.8\Modules
The only way around this restriction is to completely disable UAC, which is not recommended for security reasons.
The best solution is that should actually have cmake in your path and be using a non-protected location such as somewhere inside your user profile.
ANSWER 2
Score 13
The Program Files folder is protected by Administrator rights. In Windows XP and earlier, most people ran as Administrator all of the time. Many programs assumed this was the case and did all their work in the Program Files folder.
When Windows Vista was released, they stopped this practice, forcing applications to instead use:
C:\Users\%Username%\AppData
This broke a lot of older applications. To allow older application to continue using Administrator only folders, Windows created a virtual store to keep altered files in. Take a look in:
C:\Users\%Username%\AppData\Local\VirtualStore
You'll find your files there. You can also use Explorer by opening the folder and pressing the Compatability files button at the top of the window.
ANSWER 3
Score 0
I had a similar problem, shortly after moving to Windows 7 (from XP) I was trying to unzip a file inside C:\Program Files
and it kept giving me an Access Denied error.
After much wrestling I found that I had to take ownership of the entire folder before I could change the permissions to allow the Administrators group Full Access—which, in my opinion, it should rightly have.
In order to take ownership of a folder: right-click on the folder and go to Properties
, then click on the Security
tab, then click Advanced
, then the Owner
tab, and click Edit
. Check "Replace owner on subcontainers and objects", then select the new owner (e.g., the "Administrators" group), then say OK
.