How To Check Which Process is Using Or Locking File Or Folder In Windows

How To Check Which Process is Using Or Locking File Or Folder In WindowsHow To Check Which Process is Using Or Locking File Or Folder In Windows

Key Points

  • If a file is in use, you check which process is using it from Sysinternal’s Process Explorer. Launch the app, drag and drop the Gunshot icon onto the window of the file or folder, and it will highlight the associated process. Right-click the process and kill it to release the file.
  • The Resource Monitor can also be used to release locked files. Open the Resource Monitor, switch to the CPU tab, expand “Associated Handles“, search for the file, right-click the process, and kill it.

While attempting to move, cut, or delete a file or folder, you may encounter an error message preventing you from performing the task. It happens when the system locks a file or folder and does not allow any operations to be performed, and the most common cause for this is that the file is actively in use by another program or a process.

Sometimes, the popup dialog box prompts the user to close a certain process or an application before they are allowed to perform the actions. At other times, no such intimation is given, except that we are told by the Windows OS that it is being used, and we have to figure out which app or process is using it.

You may come across one of the following error messages when a file or folder is locked:

  • The action can’t be completed because the file is open in another program
  • This file is in use by another program or user
  • The source or destination file may be in use
  • Cannot delete file: Access is denied
  • There has been a sharing violation
  • Make sure the disk is not full or write-protected and that the file is not currently in use

Note that none of these prompts tells you which process or app is locking the item and preventing you from completing the task. So how do you tell which process has the file open, or which app is using it?

There are multiple ways of checking which process or app is using the file you want to modify. Additionally, you can also end those processes to release the files and perform your tasks without hindrances and prompts.

Identify and release locked file with Sysinternals Process Explorer

Process Explorer is a portable utility by Sysinternals whose primary function is to provide information on processes and everything there is to know about them. It can also be used to manage the processes.

Using Process Explorer, you can check which process is locking a file or folder, and then also end the process which in turn will release the file.

Apply the following steps to download and use Sysinternals Process Explorer to identify which process is locking a file:

  1. Open the Sysinternals Process Explorer page and download the tool.

    Download Sysinternals Process Explorer
    Download Sysinternals Process Explorer
  2. Right-click the downloaded package and click “Extract all.”

    Extract contents
    Extract contents
  3. Click Extract in the extraction wizard.

    Extract Process Explorer
    Extract Process Explorer
  4. Right-click the “procexp64.exe” file and then click “Run as administrator.”

    Note: If you have a 32-bit operating system, then run the proexp.exe file as an admin instead.

    Run Process Explorer as administrator
    Run Process Explorer as administrator
  5. Now that Process Explore is running, there are two ways to find and close the process locking the file or folder:

    • From searching

      1. In Process Explorer, click Find in the ribbon menu, and then click “Find Handle or DLL.”

        Find handle using Process Explorer
        Find handle using Process Explorer
      2. Enter the file or folder name that is locked and then click Search.

        Search for the file handle
        Search for the file handle
      3. Click on the associated process using the file in the Search window.

        This will automatically highlight the process in the Process Explorer window as well.

        Select the associated process locking the file or folder
        Select the associated process locking the file or folder
      4. Right-click on the process in the Process Explorer window and click “Kill process tree.”

        Kill process locking the file using Process Explorer
        Kill process locking the file using Process Explorer
    • Using the gunshot icon

      1. Click and hold the gunshot icon in the top menu, and drop it over the locked file or folder.

        Drag and drop the gunshot icon on the locked file or folder
        Drag and drop the gunshot icon on the locked file or folder

        The associated process locking the file will now be highlighted in the Process Explorer.

      2. Right-click on the highlighted process and click “Kill process tree.”

        Kill process locking the file using Process Explorer
        Kill process locking the file using Process Explorer

Process Explorer is a quick and handy method to identify which file(s) are being used by which processes, so you can free them up and perform your more important tasks at hand first.

That being said, caution is advised while performing these steps, since killing the system-critical processes can affect how the OS operates, or worse, damage the files permanently if they are interrupted in the middle of another task.

Check and release locked file using Resource Monitor

Resource Monitor is a Windows-native utility that can be used to monitor the different system resources, including the CPU, the GPU, the RAM, disk, and network bandwidth. It can also be used to display and manage the processes using certain files or folders, using which, you can release them by ending the process using them.

Use the following steps to release a file or a folder using the Resource Monitor so you can continue to perform your own action:

  1. Press the Windows key + R to open the Run Command box.

  2. Type in “resmon” and press Enter to launch the Resource Monitor.

  3. Switch to the CPU tab and then click “Associated Handles” to expand it.

    Open Associated Handles in Resource Monitor
    Open Associated Handles in Resource Monitor
  4. Search for the name of the locked file in the Associated Handles section.

    This will show a list of the processes using that particular file.

    Search for the locked file in Resource Monitor
    Search for the locked file in Resource Monitor
  5. Right-click on the process using the file and then click “End process.”

    Release locked file using Resource Monitor
    Release locked file using Resource Monitor

Identify process locking the file using command line

If you are a fan of the command line, then you can use the Command Prompt to check which process is using the file. This can be achieved using Microsoft’s Handle command-line utility, but note that it will only inform you about the process. You cannot kill the process using this tool.

You can however use the Task Manager or the “kill” command to end the process.

Here are the steps to download and use Handle to check which process is using a locked file:

  1. Go to the Handle page and download the tool.

    Download Microsoft Handle
    Download Microsoft Handle
  2. Extract the downloaded package.

  3. Now press the Windows Key + R to open the Run Command box.

  4. Type in “cmd” and press CTRL + Shift + Enter to run an elevated Command Prompt.

  5. Now use the “cd” command to change the current directory to the extracted Handle folder.

    cd /d [PathToHandleFolder]
    Change directory to the extracted Handle folder
    Change directory to the extracted Handle folder
  6. Now, run the following command while providing the complete path to the locked file (including file extension) to check which process(es) is using it:

    handle.exe -a -u "[CompletePathToLockedFile.Extension]"
    Check which process is using the locked file using Command Prompt
    Check which process is using the locked file using Command Prompt

As you can see in the example above, I provided the complete path of the file, along with its correct extension, inside inverted commas. This is because the path had spaces between some words, and for it to be Command Prompt-readable, it needs to be inside inverted commas.

After running the command, Handle returned the name of the process using the file, including other useful information, such as the process ID. You may now use this information to kill the process from the Task Manager, or using the Command Prompt.

Check and release locked files using third-party tools

Like Microsoft’s own utilities, there are also a plethora of third-party tools that offer similar functionality and can be used to find and release locked files. Many of these tools are freeware and safe to run on your Windows computers.

Here are a few third-party tools to identify and kill processes using certain files and folders:

Closing words

Coming across a file that you need to modify and finding that it is locked can be annoying, especially when you do not know where it is being used.

Usually, such issues can be resolved by restarting the computer, which unlocks the files and leaves it free for you to delete, edit, or move. However, one cannot always restart a PC when coming across such issues. In such instances, you can use the native Resource Monitor, the Process Explorer, or any number of third-party tools to check which process is using it, so it can be ended and the file can be freed.

If you liked this post, Share it on:
Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Leave the first comment

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information

Talk to us now

Talk to us straight and get your questions answered right away

Tell Us About Your Project