Tag Archives: delete locked file

Find out which program is locking a file with Process Explorer (Windows)

Ever wonder why you can’t delete a file? When the dreadful message appear: “Your file is opened in another program”, the stupid computer won’t allow you to delete that file!

We have just the solution: Process Explorer from Microsoft. I choose to introduce this program because it is easy to use, even if you don’t know anything about bash script and the likes. Let’s see how it works:

1. Download Process Explorer from Microsoft TechNet

2. Start the program. No installation needed

Process Explorer

3. Open menu Find/Find File or DLL Handle

Open menu Find Handle

4. Search for the file/folder name you want. Take note of the PID (Process ID)

Search file name and take note of the PID

5. Use Ctrl + Alt + Del to open task manager

6. In Menu View, enable column PID for Task Manager

Enable custom column for task manager

Enable custom column PID for task manager

7. Sort Task Manager processes by PID. Find the troublesome process and kill it

Kill the possessing process

The other scenario that this tool could prove useful:

1. To track down a “lingering” DLL that refuse to go away (eg: Visual Studio refuse to build because it cannot delete the old DLL)

2. Cannot clear an old folder “just because” it is opened in windows explorer

3. You cannot delete a file because another user has it opened in their notepad in their session

Credit: this solution is taken from many places, yet the most credible source is the question “Find out which process is locking a file or folder in Windows” in StackExchange SuperUser.