How to deny delete/modify permission to a file?
I want to deny myself the ability to modify or delete an executable.
When .NET Reflector asks you if you want to update:
and you choose No it spontaneously deletes itself as retribution:
So I want to prevent myself from being able to Delete
the executable; as punishment for their punishment.
I tried to Deny me Write
permission (and deny it to Everyone, and Administrators):
Except, I can still Right-Click -> Delete the file...
How do I deny the delete/modify permission to a file?
On Windows, it is enough to have one of:
- "Delete" on the object, or
- "Delete child" on its parent
Therefore a file will only become undeletable if you deny both.
Use icacls
to edit the permissions:
-
Deny "Delete" to the file:
icacls Reflector.exe /deny Everyone:(D)
-
Deny "Delete child" to the folder:
icacls . /deny Everyone:(DC)
(Tested on Windows XP.)