Unable to delete or move or perform any action on a file because it is locked by a process? Find out which process is locking a file in Windows 10 using various methods discussed in this article.
Many times, when we attempt an action (delete, rename, copy, etc.) on a file, we get a File in Use dialog box showing a prompt that “The action can’t be completed because the file is open in another program“. In some cases, it will show the process or program name that is using the file. But, a lot of times, it doesn’t.
Now, how to tell which process has a file open? If it is urgent, you need to identify the process locking a file and then end the process to modify the target file. In this guide, we will be discussing different methods to check the process that is holding a file in Windows 10.
How to tell which process is locking a file in Windows 10
Here are the different methods to identify the process that is locking a file in Windows 10:
- Check the process that is locking a file using Resource Monitor.
- Use SysInternals Process Explorer to identify the process that is locking a file.
- Find out through Command Prompt using the Handle tool.
- Use OpenedFilesView freeware to identify the process holding a file.
Let’s elaborate on these methods now.
1] Check the process that is locking a file using Resource Monitor
Using Resource Monitor, you can identify the process or service locking a file. It is an inbuilt utility in Windows 10 that helps you monitor CPU usage, memory, disk network, file handles, etc.
Open Run app by pressing Windows + R hotkey and then type resmon in it. Press the OK button and Resource Monitor will open up.
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 right-click on the process and select the End Process option to end it. After the process ends, try performing the action you wanted to on the previously locked file.
2] Use SysInternals Process Explorer to identify the process that is locking a file
Another option to identify the process or service holding a file is SysInternals Process Explorer. It is an advanced utility to find out detailed information regarding running processes on your system. To identify the process holding a file through it, you can follow below steps:
Firstly, download and run SysInternals Process Explorer on your PC. Now, in the Process Explorer window, go to the File menu and click on the Find Handle or DLL option. Next, enter the file name in the Process Explorer Search dialog window and press the Search option. All the processes that are using the file you entered will show up in the results.
Right-click on the identified process in the Process tab and then close it.
Now, check with the file if it is still held or locked by a process or not.
3] Find out through Command Prompt using Handle tool
Handle is a command-based utility to tell which process has a file open. It is basically a command-line version of the above discussed SysInternals Process Explorer. You can follow the below steps to check the process holding a file in command prompt using this tool:
handle.exe -a -u <filename-with-path>
handle.exe -a -u "C:\Users\KOMAL\Documents\Sample Files\twc.pdf"
As you enter the command, it will display a list of processes holding the file with process ID and username.
I tried to check the same by entering just the filename without the full path, it worked. But, it may not work for all files. So, it is recommended to enter the location of the locked file.
After identifying the process, you can close it from Task Manager.
4] Use OpenedFilesView freeware to identify the process holding a file
OpenedFilesView is a portable application to view all your opened files and the processes holding them. You can download its ZIP folder, extract it, and then run its OpenedFilesView.exe file to launch its interface. It will then display all currently opened files with respective details including process name, process ID, process path, file permissions, target file path, etc.
Locate your target file and check which process is holding it. Also, you can use its Find option to quickly search for a locked file and the associated process. After finding the process, right-click on the file and close all the processes holding it.
Hope this guide helps you identify the process holding a file and then close it.