Viewing and releasing file handles

Archive for January, 2007

Viewing and releasing file handles

Posted by

Ever try to delete a file and get a message such as “cannot delete: it is being used by another person or program” or the message “the action can’t be completed because the file is open in another program”? The solution to the problem finding and releasing the file handle lock.

Handle.exe is a free utility available from Sysinternals that allows you to find, view, and close file handles. Of course, if you can, it is better to close the handle with the application. But if the handle is hung or must be closed manually, Handle.exe is the way to go.

The syntax is handle.exe -p <process ID> -c <handle ID> -y. For example:

 

C:\Toolbox>Handle.exe plugin.jar

 

Handle v3.2

Copyright (C) 1997-2006 Mark Russinovich

Sysinternals – www.sysinternals.com

 

firefox.exe pid: 5508 5B4: C:\Java\jre5\lib\plugin.jar

java.exe pid: 4632 638: C:\Java\jre5\lib\plugin.jar

java.exe pid: 6332 628: C:\Java\jre5\lib\plugin.jar

 

C:\Toolbox>Handle.exe -p 5508 -c 5b4 -y

 

Handle v3.2

Copyright (C) 1997-2006 Mark Russinovich

Sysinternals – www.sysinternals.com

 

5B4: File (RW-) C:\Java\jre5\lib\plugin.jar

 

Handle closed.

 

C:\Toolbox>Handle.exe plugin.jar

 

Handle v3.2

Copyright (C) 1997-2006 Mark Russinovich

Sysinternals – www.sysinternals.com

 

java.exe pid: 4632 638: C:\Java\jre5\lib\plugin.jar

java.exe pid: 6332 628: C:\Java\jre5\lib\plugin.jar

 

C:\Toolbox>

 

(Edited 2009-12/28 with the updated URL to download Handle.exe.)