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
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:
- Resource Monitor
- 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’s Performance Tab
From CPU tab, use the search field in the Associated Handles section
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”.
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».
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.
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.
When you try to open, delete, move, rename or edit a file, the action fails because a process is using the file and thus Windows returns an error that reads “”File In Use – the action can’t be completed because the file is open in another program“.
In some cases, Windows may prompt the error and tell you the which program is using the file, but in other cases, it will just show “open in another program” which you will have to figure it out yourself.
This guide will show you several methods on how to find out which process is currently using a specific file in Windows 11, and how to unlock a file that is locked by a process.
Find which process is using a file in Windows 11
In Windows 11, you can quickly check which process is using a file without installing any third party software. You can do so using the Resource Monitor tool in Windows 11, or by using a command line in Windows PowerShell or Command Prompt.
Check which process is locking a file using Resource Monitor
Resource Monitor is a Windows built-in tool that allows you to monitor resource consumption such as CPU, memory, disk and network usage of active processes in Windows 11. There is also a section called Associated Handles which you can search for the process that is using and locking a file by entering the name of the locked file.
- First, open Resource Monitor by typing resmon in the Start and hit Enter.
- In the Resource Monitor window, go to the CPU tab.
- Next, click on Associated Handles to expand the section.
- In the search box next to Associated Handles, type the name of the file that is locked by a program, then hit Enter to search.
- The search result will return any process it finds to be locking the file.
In the example above, I have a file named sample.pdf which was locked by Adobe Acrobat Reader. Thus, when I search for sample.pdf in the Associated Handles, it returned AcroRd32.exe as the search result, which is the process that was locking the sample.pdf file.
Once you know which process is locking the file, you can then terminate the process by either closing the program manually or by killing the task via Task Manager so that you can perform action on that particular file.
Tip: Alternatively, you can also open Resource Monitor through Task Manager (Ctrl + Shift + Esc) > Performance > Open Resource Monitor.
Windows PowerShell / Command Prompt
To identify which process is using a file via Windows Terminal (PowerShell) or Command Prompt in Windows 11, we need to use a command-line utility called Handle which allows users to tell which process is locking a specific file.
However, Handle is not included in Windows by default. You will need to first download it from https://docs.microsoft.com/en-us/sysinternals/downloads/handle.
The file you will be downloading is a zip file that contains the handle.exe. Once downloaded, extract the zip file to anywhere you want.
To correctly use handle.exe as a command line to find which process is using a specific file, in the folder where you’ve unzipped the handle.exe, right-click in the folder and select “Open in Windows Terminal” to open Windows PowerShell in this directory.
In the PowerShell window, enter the following command.
.\handle.exe -a -u "path to the locked file"
For example, to find the process that is locking my sample.pdf, I need to enter the following command.
.\handle.exe -a -u "C:\Users\alvin\Desktop\sample.pdf"
If you run Command Prompt instead, use the following command. Make sure the command prompt is opened in the folder where you’ve extracted the handle.exe. Otherwise you will have to enter the full path to the handle.exe instead of just handle.exe.
handle.exe -a -u "path to the locked file"
How to unlock a file locked by a process using Unlocker
If you don’t mind downloading and installing a third party software, we recommend Unlocker by IObit. Unlocker is a simple utility tool for Windows that is able to identify the process that is locking a file and unlock the file directly should you choose to.
To learn how to unlock a locked file in Windows 11 using Unlocker, read: How to Force Delete a File in Use by Another Program on Windows 11/10.
When a file or directory is in use by a process (application), you will not be able to delete or modify the file / directory.
Unfortunately it’s not always obvious which process is using the file.
Luckily, there is an easy way to find out without the need of 3rd party tools, which is what we’ll look at in this post.
If you prefer videos, you can see the same content in this video.
Error message
If you attempt to use File Explorer to delete a file that is in use by another process, you will get an error message similar to:
File In Use
The action can’t be completed because the file is open in [process name]
Close the file and try again.
If you attempt to delete the file in a different application, the wording of the error message may be different.
Similarly, if you attempt to modify a file that is in use by another process, you’ll likely get an error about not being able to write to the file because it’s in use or locked by another process.
Same thing if you try and rename or delete a directory that is in use by another process.
The exact wording of the error message will vary depending on the application being used to update / delete the file / directory.
Reproduce the above error message
To reproduce the above error, I used the following PowerShell script and then attempted to delete the file in File Explorer:
[string] $tempFilePath = "C:\Temp\FileLock\Temp.txt"
$tempFile = [System.IO.File]::Open($tempFilePath, [System.IO.FileMode]::OpenOrCreate)
# $tempFile.Dispose() # Close file when done reading/writing
Normally you would close the file using the Dispose method when done reading / writing, but I commented that out so the file lock would remain in place.
Finding which process is using the file / directory
Windows has a built-in way to see which processes are actively using a file or directory, using the Resource Monitor
.
To open the Resource Monitor
, you can simply hit the Windows Key and search for it.
It can also be found in the Task Manager’s Performance
tab.
Simply open the Resource Monitor
, go to the CPU
tab, and enter the file or directory path you want to check into the Search Handles
box, making sure to not include quotes around the path.
If a process has a handle to the file or directory, you should see results:
]
Note that it shows you the PID (Process ID) of the process that has the handle to the file or directory.
This is important because you may have several processes with the same name in Task Manager, so you can use the PID to identify which process is using the file or directory.
From there you can use the Task Manager
to find out more about the process, or simply right-click the process in the Resource Monitor
window and select End Process
to kill the process and release the lock on the file / directory.
Once that is done you should be able to modify or delete the file or directory.
Happy process hunting
Файл занят другим процессом, заблокирован другим процессом или открыт в другой программе — простое решение
Распространенная проблема при попытке удалить, переименовать, переместить или изменить файл или папку — сообщение о том, что процесс не может получить доступ к файлу, так как этот файл занят другим процессом, о том, что папка или файл открыты в другой программе и аналогичные.
В этой простой инструкции новый простой способ узнать, какой именно процесс мешает действиям с файлом или папкой в Windows 11 и Windows 10, закрыть такую программу и выполнить требуемые изменений. На близкую тему может быть полезным: Как удалить файл, который не удаляется в Windows.
File Locksmith — новая функция Microsoft PowerToys для разблокировки файлов
Заблокированный другим процессом файл или папка — типичная ситуация, при этом Windows не всегда сообщает пользователю, о каком именно процессе идёт речь.
На сайте уже несколько раз обновлялся обзор полезной и бесплатной утилиты Microsoft PowerToys, содержащей набор инструментов для работы в системах Windows 10 и Windows 11. В начале ноября в ней появилась ещё одна возможность — File Locksmith, которая и поможет в рассматриваемой ситуации.
File Locksmith позволяет легко определить, какие процессы используют файл или папку (а точнее — её содержимое) и быстро закрыть эти процессы. Далее подробно о том, как именно работает функция:
- Установите Microsoft PowerToys, если ещё не установили. Проще всего это сделать из магазина приложений Microsoft Store используя поиск в магазине или ссылку https://aka.ms/getPowertoys, также есть другие способы загрузки: https://learn.microsoft.com/ru-ru/windows/powertoys/install
- После первого запуска приложения может потребоваться перезапуск PowerToys от имени администратора в главном окне приложения (в моем тесте функция File Locksmith не появилась в меню до выполнения перезапуска на одном из устройств).
- В параметрах Microsoft PowerToys убедитесь, что функция File Locksmith включена.
- Нажмите правой кнопкой мыши по файлу, который занят другим процессом и выберите пункт меню «Какие процессы используют этот файл?». В Windows 11 потребуется предварительно открыть классическое контекстное меню, нажав «Показать дополнительные параметры».
- Откроется окно со списком процессов, использующих этот файл. Если процесс не отображается, выполните перезапуск окна с правами администратора, нажав по значку справа вверху.
- Раскрыв свойства процесса, вы можете узнать его идентификатор (например, для завершения вручную), а также от имени какого пользователя он запущен.
- Действие по проверке использующих элемент процессов можно применять и к папке, в таком случае будет отображаться список всех процессов, использующих её содержимое, а раскрыв сведения можно получить информацию о том, какие именно файлы использует этот процесс.
- И, самое главное, прямо в окне File Locksmith можно завершить процесс. Однако будьте осторожны при завершении системных процессов Windows.
Надеюсь, новый инструмент будет полезен. Конечно, есть и другие возможности, например, многие используют Unlocker, но вариант с File Locksmith куда более безопасен для пользователя, на мой взгляд.