Interestingly, I did not know this! I just tried it, you can set the readonly attribute to a folder using the command attrib, but this has no effect.
The only alternative that I see is to set the access rights to the directory based on the user account, if it is located on a disk with the NTFS file system. Check out Microsoft's Xcacls tool .
Take care, however, that NTFS access permissions are much more complex than unix type access control. In general, it is better not to allow a certain type of access than to deny it. I think that this is no longer a problem today, but I remember how good old NT 4 was, my friend was able to refuse access to the folder, including the administrator account. After that, he could not do anything, not even delete ...
source
share