Why can’t I delete that file?

September 2, 2009

Just a really quick post because I should be working, but I found this out just today and it’s really very useful. Whenever you get a file that you can’t delete you just want to throttle windows, or the application that’s holding the file under it’s selfish control. Well, you can find out what is holding that file with a wonderful tool called Handle.

It is a command line tool but it’s very easy to use, simply type in the following and you’ll be told (in slightly verbose terms) what has a handle to what:

handle

You will get a lot of output, but you might see something like this

——————————————————————————
EXCEL.EXE pid: 3712 TRUMPET\hba

530: File (R–) C:\Documents and Settings\hba\Desktop\Book1.xls

——————————————————————————

This tells us that Excel.exe has a handle on the Book1.xls meaning we can’t do stuff to it. You can make your life easier by using the following command to save the output from Handle so you can go back over it later (the following command saves the output to C:/handle.txt).

handle > C:\handle.txt

There you go then, that’s that, not so technical so sorry about that maybe it’ll do a more in depth one later.