How To Know Which Process is Using a File or Folder in Windows

Ever wondered which program has a particular file or directory open? Quite often, when trying to delete a folder, Windows reports this:

Folder In Use

Folder In Use

The action can't be completed because the folder or a file in it is open in another program

This error also happens with a file, when we tried to move a file, or delete those file. How we can find out which program or application is currently using it and preventing us to delete/move it? To get the process holding those folder or file, we can use these two utilities:

  1. Resource Monitor
  2. Process Explorer

Resource Monitor

For Windows 7 and above, you can use the built-in Resource Monitor.

Open Resource Monitor, which can be found

  • By searching for resmon.exe in the start menu, or
  • As a button on the Performance tab in your Task Manager
Resource Monitor from Task Manager

Resource Monitor from Task Manager's Performance Tab

From CPU tab, use the search field in the Associated Handles section

Resource Monitor

Resource Monitor

When you've found the handle, you can identify the process by looking at the Image and/or PID column. You can then close the application if you are able to do that, or just right-click the row and you'll get the option of killing the process (End Process) right there.

Process Explorer

Process Explorer shows you information about which handles and DLLs processes have opened or loaded.

  • Open Process Explorer (running as "administrator") by running procexp.exe or procexp64.exe.
  • Enter the keyboard shortcut Ctrl+F. Alternatively, click the “Find” menu and select “Find a Handle or DLL”.
procexp Find Handle

Process Explorer - Find Handle or DLL

  • Type in the name of the locked file or other file of interest in the Search dialog box, then click "Search". Partial names are usually sufficient.
  • A list will be generated. There may be a number of entries. Click one of the entry, it'll "Refreshing handles".
procexp Search

Process Explorer - Search

Same as Resource Monitor, an individual handle in the list can be killed by selecting it and pressing the delete key (or Close Handle). However, please be careful when deleting handles, as system instabilities may occur. Rebooting your system maybe will free the locked file/folder.

procexp Close Handle

Process Explorer - Close Handle

Handle is a command line version of Process Explorer.

My Take

I prefer to use Resource Monitor compare to Process Explorer since Process Explorer is slower (especially during "Refreshing handles" process). If I can't find the handle in Resource Monitor, then I use Process Explorer.