Often on my development workstation (on which I am administrator and the only user), I am unable to delete files by deleting the root folder - despite having recursively taken ownership of the tree. I am presuming that this is due to the file being locked by another process.

What (scriptable) options do I have that can help here?

Comment: I should have also said that I'm on 2008 x64.


5 Answers 5


You could use LockHunter to see which process is blocking the deletion of a file. It's a freeware tool for Windows (32 bit and 64 bit versions available) which integrates itself into the Windows Explorer context menu.

It is a free tool to delete files blocked by something you do not know. LockHunter is useful for fighting against malware, and other programs that are blocking files without a reason. Unlike other similar tools it deletes files into the recycle bin so you may restore them if deleted by mistake.

LockHunter Screenshot
(source: lockhunter.com)

  • Looks good - 64 bit support too :) Jul 29, 2009 at 12:36
  • 1
    Having now used this software, I like it even more than Unlocker (which I've used for ages when on 32 bit OS). This puppy is slicker to use and works on x64 too, which is great! Okay, it's not scriptable, but I have added a feature request on their site that is becomes so...I'll wait and see. Thanks splattne! Jul 29, 2009 at 21:40

With MoveFile from Sysinternals you can schedule the deletion for next reboot or you could try to unlock the file with Unlocker.

  • Thanks jonelf - unfortunately Unlocker does not currently support 64 bit OS and I don't want to have to reboot to delete the files. Jul 29, 2009 at 12:34

I posted this on this thread. Basically I use Systernal's Process Monitor to see what's locking the file. This How-to is great on how-to use it for this purpose.


If the file is locked via another process then use ffunlocker.

It isn't a scriptable solution but it is worth mentioning.


unlocker is great for doing this [right click, unlock]

You must log in to answer this question.

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