How can I tell what process has a file opened on Windows?


Use Windows Sysinternals Handle utility.

For example, download http://download.sysinternals.com/Files/Handle.zip and extract handle.exe to a directory in your PATH such as C:\Windows. Or copy it to a new directory named C:\Sysinternals and add that to your PATH.

Here are some examples:

handle -help
will show the usage information.

handle name_fragment
will show all handles in the system that refer to open files whose names include name_fragment

handle -a name_fragment
will show all types of handles in the system that refer to resources whose names include name_fragment. Use -a if you want to see resources on network attached storage (NAS) or a storage area network (SAN). For example, if drive M: is mapped to a network share named \\MyServer\public, use the following command to see what processes and users have opened the file W:\mydir\myfile:

handle -a -u \MyServer\public\mydir\myfile

or simply:

handle -a -u myfile

For more information about Windows Sysinternals visit http://technet.microsoft.com/en-us/sysinternals/default.aspx


Article ID: 135
Created: July 13, 2010
Last Updated: July 13, 2010
Author: Support KB Author

Online URL: https://support.veryant.com/support/phpkb/article.php?id=135