I want to deny myself the ability to modify or delete an executable.

When .NET Reflector asks you if you want to update:

enter image description here

and you choose No it spontaneously deletes itself as retribution:

enter image description here

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):

enter image description here

Except, I can still Right-Click -> Delete the file...

How do I deny the delete/modify permission to a file?

  • Yeah, write access has nothing to do with delete permission. This seems like a rather draconian way to solving this problem. – surfasb Jul 12 '11 at 18:33
  • i'm surprised at a downvote. i would think being able to stop something from modifying your files would be a useful question. – Ian Boyd Aug 29 '11 at 23:12
  • @surfasb Write access very well may have nothing to do with delete. i only include things i've tried because some people get grump when i simply ask the question. And some people will give spiteful downvotes if i don't "show research effort". – Ian Boyd Jan 15 '12 at 15:12
  • Upvote solely because I find the question quite amusing. Then I recalled painful times with the Adobe Flash installer and suddenly I feel less amused. – Mark K Cowan Nov 3 '14 at 11:05

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.)

| improve this answer | |
  • Denying Modify permission also removes Execute permission; and i can still delete the file! – Ian Boyd Jul 12 '11 at 18:38
  • As I said, "You may also have to deny "Delete items" on the folder"... Which too can be done with icacls. – user1686 Jul 12 '11 at 20:39
  • On the downside that would deny the ability to delete other items in the folder. Given that it doesn't seem to be working, i presume it is not possible to deny the ability to delete a file - deletes must happen against folders, rather than files. – Ian Boyd Jul 13 '11 at 2:25
  • Edit your answer to indicate that it cannot be done, "But here are some alternatives that might be useful", and you'll get the accept. – Ian Boyd Jul 13 '11 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.