Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify process using a file

People also ask

How do you know which process is using a file in Windows 11?

In the Resource Monitor window, go to the CPU tab and expand the Associated Handles option. Now, in the search box, type the name of the file that is showing locked by a process and press Enter button. It will show you a list of processes holding the target file.


You can use handle.exe from Sysinternals.

Something like:

> handle /accepteula C:\path\to\directory
...
program.exe           pid: 1234   type: File           2E4: C:\path\to\directory
...

Thanks to https://stackoverflow.com/a/599268/367916 .


You could use Process Explorer from Microsoft

  1. Download & unpack & run Process Explorer
  2. Click Find menu and then click Find Handle or DLL... or press CTRL + F
  3. Copy and paste path to locked folder of file
  4. Click Search, you can kill process from main Process Explorer window

If you can limit yourself to new enough versions of Windows, the Restart Manager can tell you which process has a particular file open.


Because of the way Process Explorer works, I suspect that what you need to look for is a way of finding the file handles attached to a given process, and that you'll have to pull that list for each process in the system and look for your file within it.