How to determine which process is locking a file in Windows 10

How to determine which process is locking a file in Windows 10

 

How to determine which process is locking a file in Windows 10

Can't delete or move a file or perform an action because it's locked by a process? Find out which process is locking a file in Windows 10 using different methods discussed in this article.

When we attempt an action (delete, rename, copy, etc.) on a file, we often get a File in Use dialog box saying ' The action cannot be completed because the file is open in another program ' in some cases displays the process or program name that is using the file. But often it doesn't.

Now how can you tell which process has a file open? If it is urgent, you need to identify the process that is locking a file and then kill the process to change the target file. This guide explains different methods to check the process containing a file in Windows 10.

Here are the different methods to identify the process that is locking a file in Windows 10:

  1. Check the process locking a file with Resource Monitor.
  2. Use the SysInternals Process Explorer to identify the process that is locking a file.
  3. Find out from Command Prompt with Handle tool.
  4. Use OpenedFilesView Freeware to identify the process that contains a file.

Now let's explain these methods in more detail.

1] Check the process locking a file with Resource Monitor

With Resource Monitor, you can identify the process or service that is locking a file. It is a built-in utility in Windows 10 that allows you to monitor CPU usage, memory, disk network, file handles, etc.

Open the Run app by pressing the Windows + R keyboard shortcut and then typing Resmon . Press the OK button and Resource Monitor will open.

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

You can right-click the process and select End Process to end it. After the process is complete, try to perform the desired action on the previously locked file.

2] Use the SysInternals Process Explorer to identify the process that is locking a file

Another option for identifying the process or service that contains a file is the SysInternals Process Explorer. It is an advanced utility to get detailed information about running processes on your system. To identify the process that contains a file, you can follow the steps below:

First, download the SysInternals Process Explorer and run it on your PC. Now, in the Process Explorer window, go to the File menu and click on the Locate Handle or DLL option . Next, type the file name in the Process Explorer search dialog box and press the Search option. All processes using the file you entered will appear in the results.

Right click on the identified process in the Process tab and close it.

Now check with the file whether it is still held by any process or locked or not.

3] Find out from Command Prompt with Handle tool

Handle is a command-based utility to determine which process has a file open. It's basically a command line version of the SysInternals Process Explorer discussed above. You can follow the steps below to check the process containing a file in Command Prompt with this tool:

Download Handle from microsoft.com and unzip the zip folder. Now open CMD in the extracted folder. At the command prompt, enter a command with the following syntax:

handle.exe-out\u>lt;filename-with-path\u>gt;

For example:

handle.exe-a-u 'C:\Users\KOMAL\Documents\Sample Files\twc.pdf'

When you enter the command, a list of processes containing the file with the process ID and username is displayed.

I tried to verify the same just typing the filename without the full path, it worked. However, 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 that contains a file

OpenedFilesView is a portable application to view all your open files and the processes they contain. You can download the zip folder, unzip it, and then run OpenedFilesView.exe to launch the interface. It will then display all currently open files with the relevant details including process name, process id, process path, file permissions, destination file path, etc.

Locate your target file and see what process it contains. You can also use the Find option to quickly search for a locked file and its associated process. After finding the process, right-click on the file and close all processes that contain it.

I hope this guide helps you identify the process that contains a file and then close it.

แสดงความคิดเห็น

Designed by OddThemes | Distributed by Gooyaabi