"The action can't be completed because the file is open in another program" is one of Windows' most annoying messages, especially when it doesn't tell you which program. You can't delete, rename or move the file, and a USB drive may refuse to eject. The good news is that Microsoft makes several free tools that tell you exactly which process is holding on, and some can release the file for you. These picks are based on Microsoft's documentation for each tool, checked on 30 November 2026.
Before you start: close it the safe way
Whichever tool you use, the safest fix is to close the program normally once you know what it is, so it can save its work. Ending a process or force-closing a handle can lose unsaved data, and Microsoft warns that closing handles "can cause application or system instability". If the culprit is a Windows process you don't recognise, a restart is often the safer option.
1. PowerToys File Locksmith: best for most people
File Locksmith is a PowerToys utility that, in Microsoft's words, "helps you identify which processes are using specific files or directories in Windows". It adds itself to File Explorer's right-click menu, so there's nothing to type.
Install PowerToys (see our PowerToys guide), open it and turn on Enable File Locksmith.
In File Explorer, select the file or folder, right-click, choose Show more options, then Unlock with File Locksmith. If you pick a folder, all its files and subfolders are scanned too.
File Locksmith lists the processes using it. Select End task to terminate one, or expand it for more detail.
Microsoft notes that processes run by a different user can't be accessed and may be missing, so if the list is empty, select Restart as administrator to scan everything. There's also a command-line version, PowerToys.FileLocksmith.CLI.exe, with --kill to end locking processes, --json for scripts and --wait (with an optional --timeout in milliseconds) to wait until the files are released.
Best for: anyone who wants a point-and-click answer from File Explorer.
2. Process Explorer: best for seeing the full picture
Sysinternals Process Explorer (version 17.21 at the time of writing) is a free Microsoft tool that shows which handles and DLLs each process has opened or loaded, and Microsoft says it "also has a powerful search capability that will quickly show you which processes have particular handles opened or DLLs loaded". Search for part of the file name and it lists the processes that have it open.
It shows much more than file locks, which makes it useful if you're also chasing a slow PC or a suspicious process. Our Process Explorer guide covers the basics, and Process Explorer vs Task Manager explains when it's worth the extra complexity.
Best for: power users who want to see exactly what a process is doing, not just end it.
3. Resource Monitor: best if you can't install anything
Resource Monitor is already part of Windows, so it's the one to use on a work PC or a friend's machine where you can't add software. On its CPU tab, the Associated Handles pane lets you search by part of a file or folder name, or even a drive letter, which is handy for a USB drive that won't eject. We walk through it step by step in our Resource Monitor guide.
Best for: locked-down PCs and quick checks without downloads.
4. Sysinternals Handle: best for scripts and the command line
Handle (version 5.0) is the command-line sibling of Process Explorer. Microsoft describes it as "a utility that displays information about open handles for any process in the system", and you need administrative privilege to run it. Type handle followed by part of a path, for example handle windows\system, and it shows which processes have matching files open; Microsoft says the match is case-insensitive and the fragment can be anywhere in the path.
Useful switches include -p to limit the search to processes whose names start with a given string, -u to show the owning user name and -v for CSV output. -c closes a specific handle (you give the handle value and the process ID), but this is the risky option Microsoft's instability warning applies to, so use it only when you understand what you're closing.
Best for: IT admins and anyone scripting checks across many files.
Which should you pick?
Tool | How you get it | How you use it | Ideal user |
|---|
File Locksmith | Part of PowerToys | File Explorer right-click menu (plus a CLI) | Everyday users |
Process Explorer | Free Sysinternals download | Search by file name | Power users |
Resource Monitor | Built into Windows | Associated Handles search on the CPU tab | Locked-down PCs |
Handle | Free Sysinternals download | Command line, admin rights needed | Scripts and admins |
For more of Microsoft's free utilities, see our best Sysinternals tools and best PowerToys utilities.