Windows – Unable to set read-only property on temp folder

file-attributesread-onlytemporary-fileswindowswindows xp

I'm trying to make the \documentsettings\user\temp folder as read only to prevent files from writing files into it ( I have reasons to do so). But I've tried all the basic methods of doing so, from the command line using +R on the folder, but it refuses to stay in the read only mode. Basically what I'm trying to achieve is to prevent files being created on the temp folder. I don care about applications that would crash if it was denied access into it. In fact, I am testing what applications crash on making it read n

Best Answer

The read-only property on folders (+R) does not do what you think on windows. See

Windows may also store customization information in ahidden Desktop.ini file in the folder. In this case, Windows sets the read-only attribute on the folder to instruct Windows to look for the Desktop.ini file. The read-only attribute does not prevent you from performing common file and folder tasks (such as copy, move, delete, and rename)

To truly make a folder read-only you need to be on a NTFS file-system and set the permissions on the folder instead which appear under the Security tab (right-click the folder and choose Properties from the menu then select the Security tab). Remove the Modify and Write permissions of each users and group listed from the folder and then no one will be able to write to it.

You may have to click Advanced > Change Permissions and uncheck "Include inheritable permissions ... " to clear SYSTEM permissions that are often inherited from the parent.