Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a developer and as part of the build process, a Microsoft dll is copied to a certain folder. That file copy is now failing as the target can't be overwritten.

I decided to delete it by hand (using an admin account but a non-elevated explorer) so browsed to the folder and attempted a delete. This failed (Require permission from the Administrator). The same applies when using an elevated explorer.

So I tried Properties->Security->Advanced->Ownership

The current owner is showing as Unable to display current owner. I can't take ownership (a simple Access Denied message with no elaboration). Elevated Command Prompt/PowerShell don't help either (both give an Access Denied in their own way).

Process explorer shows no open handles on the file.

Eventually, I booted to linux and deleted the file but what I'd like to know is what caused it?

Security Essentials had no issues with the file. It's digitally signed by MS and the signatures match.

share|improve this question
possible duplicate of File I can't take ownership of – CharlieRB Oct 16 '12 at 14:12
@CharlieRB I've read it - but as you can see, my problem isn't removing the file but understanding what the "loss of ownership" is caused by. – Basic Oct 16 '12 at 14:23
You are right. Sorry. Guess I got lost in reading it and misunderstood the question. – CharlieRB Oct 16 '12 at 14:35
In some cases, deleting a file needs to be done externally, e.g. Safe Mode, or as you did booting into another OS. If the file has certain attributes (I'm not exactly sure but I think System affects it), along with the existing SYSTEM permissions, that makes it untouchable in the context of the booted Windows. Obviously once you go away from that context, it becomes irrelevant, but inside Windows 7 (and 8) some files are certainly undeletable. – user3463 Oct 16 '12 at 16:05
@RandolphWest Thanks for the answer. Can you explain a little more? I know anything with an open handle can't be modified but suspect that if I deleted everything I could in my windows dir then rebooted, I'd have bricked my machine - so there's no "required for windows" flag set on a lot of files. Pagefile/etc come under the heading of open handles. I just don't see how a DLL buried in a folder on my D drive which has been replaced every few hours for days can suddenly be flagged as undeletable (nor what that "flag" is?) – Basic Oct 16 '12 at 16:39
up vote 10 down vote accepted

I had this issue too for a file I manage with SourceTree ( git client ). This file had no 'Owner'. I just noticed that closing down all application susceptible to use it, removed it magically. The other option was to remove the file in windows' safe-mode. I don't know why this happened though and I'm curious too as to why this happened.

share|improve this answer
This happened to me too, which is what brought me to this question. A git checkout created a folder, then afterwards I couldn't do anything with it (and couldn't checkout anything else that would modify it!). Your comment helped me realise I had other git bash windows open; once I closed them all the folder magically deleted :) – Tim Malone Apr 26 at 0:50

One solution works for me on Windows 7 :

Right click the hard disk drive, ==> Properties / Tools / Check now .... And then try to delete again, it should work.

share|improve this answer

In my case it was a file I'd used Firefox to download. Couldn't display owner, change ownership or delete the file (though it was readable). Using lockhunter to delete the firefox lock on the file worked.

share|improve this answer
Lockhunter worked for me too. Thanks. – Steve Dowling Feb 18 at 9:42

Open command prompt with admin rights, then type:

net user administrator - this will display current settings.

Use net user administrator /active:yes to activate if needed.

This is the built-in administrator account for managing the system. It is usually not active.

share|improve this answer
Thanks for the tip but if it was owned by the local admin account, 1) wouldn't another admin be able to take ownership and 2) wouldn't the security dialog have identified the owner? It was my understanding that only the SYSTEM account had higher permissions than a user in the administrator group – Basic Oct 16 '12 at 14:27
Your understanding is correct, @Basic. – user3463 Oct 16 '12 at 16:06

I had the same issue with some files in the windows directory, most likely caused by a virus.

running sfc /scannow fixed the problem for me

share|improve this answer
"most likely caused by a virus" – Basic Dec 10 '14 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .