Often, on my Windows computers, when I go to delete or move directories or files, an error message appears explaining that this action can not be completed because one of the files is being used by another program.

Is there a program that allows me, for a given file, to find out what program is using it and end that program?

  • When I used MS-Windows, I found that most of the time it was windows explorer that had the lock on the file. I found it odd that windows explorer describes itself as another process. Feb 23, 2014 at 22:18
  • 2
    Someone should add an answer for Resource Monitor, which can be brought up easily through the performance tab of task monitor (i.e. nothing extra to install). It allows you to search for a filename and find processes that have a lock on it. I am working right now and don't have time to give it the answer it deserves. Feb 26, 2014 at 19:09
  • How come three of the answers point to Russinovich's SysInternals tools and the fourth points to adware? Apr 17, 2014 at 7:00
  • Hi Gibby, if you found any of these answers helpful, please mark them as accepted by checking the tick sign next to them. Thanks! Sep 22, 2014 at 19:52

8 Answers 8


Edit (2022): PowerToy's File Locksmith is a great Microsoft tool that does this now.

LockHunter is another great free tool.

download link

  • +1 You beat me to it. Not only does it do what is asked for here, but it functions much better than another "file unlockers". Highly recommended. I have tried them, re-try them every few months & this is still the best after many years
    – Mawg
    Jun 3, 2014 at 6:36
  • @laggingreflex, Is Unlocker's comparison with LockHunter (12 ticks vs 6 ticks) fair?
    – Pacerier
    Apr 1, 2015 at 0:53
  • 1
    @Pacerier Interesting comparison. Out of those I think I would only care about the "Unload DLL" check, rest seem trivial to me. Also I think the table might be outdated too because "With reboot" should be checked as LockHunter does have a "delete at next boot" option. Anyhow the main reason for me choosing LockHunter over Unlocker was that Unlocker didn't work on Windows 8. I don't know if it does now but on the download section it still doesn't mention Windows 8 specifically. Apr 1, 2015 at 6:59
  • @laggingreflex, What exactly does "Unload DLL" mean actually?
    – Pacerier
    Apr 6, 2015 at 2:29
  • DLLs are loaded through programs like rundll.exe, I think it means it'll unload those. Apr 6, 2015 at 9:46

I regularly use Process Explorer, (free from Microsoft), to do exactly what you are asking for you can search for which programs/tasks are using a given file or directory and then kill the program or program tree. You can even find a DLL that has a given file locked and then find and kill those programs that are using that DLL.

Process Explorer Main Window

It also gives you a lot of other useful information. System Information

  • Thank you very much, finally killed the persistent ehmsas.txt file. Works wonderfully, I just had to find the search button (it is the binoculars icon in the tool bar)
    – David
    Apr 26, 2014 at 14:47
  • @David - Glad to have helped this is one of the first programs that I install on a new Windows machine. Apr 26, 2014 at 18:27
  • @SteveBarnes, Is Unlocker's comparison with ProcessExplorer (12 ticks vs 5 ticks) fair?
    – Pacerier
    Apr 1, 2015 at 0:52
  • @Pacerier - Not quite although it does mention that the other programs such as Process Explorer do a lot of other things it misses a) You can force DLL unload simply by killing all the processes that are using that DLL, b) You can bring each program that has your file open to the front before killing it to make sure that it is safe to kill - no missing saves c) I would never consider recommending/trusing anything known to contain mal/adware Apr 1, 2015 at 5:55
  • @SteveBarnes, Regarding point A, Does "Dll unload" mean the same thing as "Force kill"? Also, you must elaborate on point C. Is unlocker a malware?
    – Pacerier
    Apr 6, 2015 at 2:29

Try Unlocker.

It creates an entry in the right-click menu of files which will show you a list of processes that are accessing the file, through which you can then detach the process (or if needed kill it outright).

I use Unlocker regularly to help me safely eject USB drives that like to have handles kept open and more often than not it does help. The only downside I have found (and this may not be a problem with Unlocker itself, but with the programs that are keeping the handles open) is that most times simply detaching the process doesn't work and I have to kill it outright.

While there are a number of more feature-full programs that can perform the same functionality as Unlocker, for the purpose of releasing file handles this is the one I have found to be quicker and to work more consistently.

Note: Please be aware Unlocker contains potentially malicious adware in the installation process and employs the OpenCandy advertising module in its installer. If you are cautious during the installation process, read every dialog presented to you, and deselect anything that doesn't sound like it is part of Unlocker then you can easily avoid installing anything malicious on your system.

The following image shows the dialog that I received as a result of the OpenCandy module, where I have already selected "Advanced" and unchecked the "Install Delta toolbar" checkbox:

Delta Toolbar installer

  • 1
    @DanteTheEgregore I thought it was only the installer that showed adware, not the Unlocker program itself. If you click the right buttons during installation, do you still get adware? Feb 7, 2014 at 17:56
  • 2
    @DanteTheEgregore Thanks for the warning. I honestly did not know about potential malware in the installer until today. I have never used the installer, but have always manually extracted the necessary files from the executable to place them in a portable package. I've edited the answer to show how to avoid the potential malware in the installer. Feb 8, 2014 at 0:04
  • 2
    Does unlocker work for windows 8? It keeps telling me "no locking handle found" even when I have the file open. Feb 8, 2014 at 21:40
  • @ValekHalfHeart I'm not sure sorry, and don't have a Windows 8 PC to check it on. Both the official site and CNET list the OS as up to Windows 7, but other download sites (including windows8downloads.com) do list it as Windows 8 compatible. Feb 9, 2014 at 1:25

With a bit of finessing, process monitor by sysinternals would do this. The only real issue is the sheer amount of information - you're expected to use the filters, but I ended up simply restricting the information shown to file system activity, and see what program is using it by searching for the exact filename (In this case, test.text).

As with any of sysinternals software, its tiny, portable and does exactly what it says on the tin - it quite literally has no other features other than monitoring processes by filesystem, registry, network and process activity. Considering the level of access it needs, it needs to be run as admin/undergo UAC escalation.

It won't let you unlock a file directly, but it will show you wnat is using it, and you can kill the parent process properly to undo the lock.

enter image description here

  • could you add some details on other features of this tool? Why you found it useful, what are possible downsides etc? Feb 9, 2014 at 18:51
  • This tool was awesome when I had a process dying because of failure to find a file. I couldn't determine what file it was looking for without this (e.g. process explorer or resource monitor show you the files that a process has locks on, not files a process failed to find). With this it was fairly easy to resolve because it logged the actual attempt to locate the file. Once I knew what file it couldn't find, I could fix the problem. Feb 26, 2014 at 19:07

handle is a Microsoft-hosted command line tool doing just that. It was written by Sysinternals, now owned by Microsoft. You can give it a file or directory name (or any "handle") and it prints the program's exe and the process ID (PID). You can give it partial filenames ie. "fragments", too.

Basic usage:

handle c:\movie.mp4

would print its header and then something like

vlc.exe       pid: 1256   type: File           1EC: c:\movie.mp4

Usage is printed with handle -h

A handy way to use it is listing the files open on your pen drive. If your pen is D:, you can run handle D: and it will print which programs use your drive and which file.

scripting notes

First usage asks GUI for EULA. There used to be an -accepteula parameter that doesn't seem to work with all recent versions. The value is stored in dword HKEY_CURRENT_USER\Software\Sysinternals\Handle\EulaAccepted. You can have the same affect as accept by adding

REG ADD "HKCU\Software\Sysinternals\Handle" /v EulaAccepted /t REG_DWORD /d 1 /f

There are many other interesting sysinternals utilities hosted at the Microsoft site.

  • 1
    the day when I'd 386 points. see you at 80386!
    – n611x007
    Apr 1, 2015 at 7:23

Process Hacker does that:

- A detailed overview of system activity with highlighting.
- Graphs and statistics allow you quickly to track down resource hogs and runaway processes.
- Can't edit or delete a file? Discover which processes are using that file.
- See what programs have active network connections, and close them if necessary.
- Get real-time information on disk access.
- View detailed stack traces with kernel-mode, WOW64 and .NET support.
- Go beyond services.msc: create, edit and control services.
- Small, portable and no installation required.
- 100% Free Software (GPL v3)



You can use the Resource Monitor for this which comes built-in with Windows 7, 8, 10 and 11!

  1. Open Resource Monitor, which can be found
    • By searching for Resource Monitor or resmon.exe in the start menu, or
    • As a button on the Performance tab in your Task Manager
  2. Go to the CPU tab
  3. Use the search field in the Associated Handles section
    • See blue arrow in screen shot below

When you've found the handle, you can identify the process by looking at the Image and/or PID column.

You can then try to close the application as you normally would, or, if that's not possible, just right-click the handle and kill the process directly from there. Easy peasy!

Resource Monitor screenshot

From: https://superuser.com/questions/117902/find-out-which-process-is-locking-a-file-or-folder-in-windows/643312#643312


[2022] PowerToys File Locksmith

Screenshot GIF

Microsoft has a new utility to the PowerToys toolset that will help Windows users find the processes using selected files and unlock them without requiring a third-party tool.

PowerToys 0.64.0 also adds a Windows hosts file editor and a long list of bug fixes and changes that add stability and improve the other built-in tools.

As its name implies, the new File Locksmith utility can be used to deal with locked files that can't be deleted or opened because Windows says another process is using them.

"File Locksmith lists which processes are using the selected files or directories and allows closing those processes," the tool's description reads.

While, until now, most users would have to install a third-party program designed to get rid of the "locked" status, you can now check which files are being used by which processes by right-clicking them in the File Explorer and clicking "What's using this file?" in the context menu.

You can then terminate any processes found by File Locksmith or scan again using administrator privileges to look for processes launched by all users.

Another screenshot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.