Windows 7 Argh, how do I fix ownership for Program Files?

MatsVed

New Member
Hi!
I was tired of not being able to save files in Program Files without starting the program [that saved files] manually as administrator. So I ran the command attrib -R "C:\program files" in the command prompt, and now Windows 7 seems to have reverted to some kind of default protection mode where all the files and folders under Program Files are write protected and I cannot create anything but a folder (which I have to do as an admin)
This is even worse!
How do I get things back to normal?

I tried disabling the write protection after I had run the attrib command, which didn't help at all. I did that twice, actually. Then I ran attrib +R "C:\program files" to see if that'd cure things, but to no avail.

Please help!
 
Welcome onboard and enjoy your stay.

Some software restrict access to folders. And you can try changing the default folder where your software saves files.

attrib +R "C:\program files" made it read-only.

Try attrib -R "C:\program files" again.

~~~~~~~~~~~~~~~~~~

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[drive:] [path] filename] [/S [/D]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes files in all directories in the specified path.
/D Process folders as well.


Read-only - allowing the file to be only viewed and not written to.

Archived - allowing Microsoft backup and other backup programs to know what files to backup.

Hidden - making the file invisible to standard users.

System - making the file an important system file.



~~~~~~~~~~~~



Under administrative account, you can right-click a folder > Properties > Security Tab > Take Ownership

or

cmd > takeown /[disk name] [folder path]
 
Thanks for your reply!
I tried running takeown /f "Program Files" after I had CD'd to C:\, and it said the command was successful. However, it still won't let me create anything but a folder (and only if I do it as an admin) when I right click in the root "Program Files" folder.
Also, I tried turning off write protection, but that didn't seem to work either.
All this was after I had run attrib -R "Program Files"
 
Try cacls

Cacls

Cacls

Code:
Displays or modifies discretionary access control list (DACL) files.
Syntax

cacls FileName [/t] [/e] [/c] [/g User:permission] [/r User [...]] [/p User:permission [...]] [/d User [...]]
Top of page
Parameters

FileName   : Required. Displays DACLs of specified files.

/t   : Changes DACLs of specified files in the current directory and all subdirectories.

/e   : Edits a DACL instead of replacing it.

/c   : Continues to change DACLs, ignoring errors.

/g   User : permission   : Grants access rights to the specified user. The following table lists valid values for permission.
 
I think you must assign a path. You cannot change "Program Files " from a read only attribute. takeown /f "Program Files\*.*

But there is an easier way. unzip the attached and run the reg file. This will put a right click option in Windows explorer, to take ownership of files or folders. Right clic Program files and take ownership.
 
Back
Top