If you try to delete a file or a folder locked by some process (open in another program) in Windows you may get an error as follows:
The action can’t be completed because the file is open in another program
The action can’t be completed because the folder or a file in it is open in another program
To delete a file or a folder that is open in another program it is required to identify and kill the process that is holding that file or folder open.
Cool Tip: List processes in Windows from the CMD! Read more →
File is Open in Another Program
To find out which program is using a file or a folder in Windows, use these tools:
As each of these tools has its pros and cons, i will describe how to use them both to find out which process is locking a file or a folder and how to kill that process if it is not possible to close it normally.
A file or a folder opened by some program can be deleted as only that program is closed or the process is killed.
This utility can be launched by pressing the ⊞ Win keybutton and searching for the
resmon in the start menu.
Go to the
CPU tab and search for the name or path to the locked file or folder in the search field of the Associated Handles section.
All processes which lock that file or folder should be listed and can be killed directly from there – just do the right click on the process to kill and select
Process Explorer is a freeware task manager and system monitor for Windows, that doesn’t require installation (portable) and can be launched without admin rights.
After you download and launch the Process Explorer, press Ctrl + F5 (or go to
Find Handle or DLL) and search for the name of the locked file or folder or the path.
All processes which lock that file or folder should be listed and can be killed from the main Process Explorer window.
Cool Tip: Kill a hanging process in Windows from the CMD! Read more →