What to do if Windows doesn’t tell you.
The scenario typically looks like this: you want to delete, move, or rename a file, or maybe use it in another application, and you get a message that says you can’t because another application is using the file.
Great. “What application?” you ask.
Let’s find out.
Become a Patron of Ask Leo! and go ad-free!
Who's using a 'File in Use'
Windows often tells you which program is using a file in use. If it doesn’t, you can search for the file in Process Explorer and figure out which program has it open. Once you know, you can either close that program, restart your computer, or take other action to fix the issue.
Windows
In the original version of this article, I said:
It wouldn’t be that hard for Windows to tell you, but as it doesn’t …
I don’t know if someone at Microsoft was listening to me specifically1, but things have gotten much better. Windows now often tells you in the error message exactly what program has your file open, as shown above.
Fantastic! If Windows tells you, you probably didn’t even need to come here to read this article. You’re done.
However, there are still scenarios where Windows doesn’t tell you, or the message might come from somewhere other than Windows itself. In that case, we go back to the old ways.
Process Explorer
Process Explorer is part of the SysInternals Suite that you can install from the Microsoft Store. If you haven’t installed the suite, I recommend you do. While Process Explorer is perhaps my most frequently used tool, there are several other tools included.
Process Explorer has a handy feature that should allow us to find exactly what we need.
Using the example above, which notes that Notepad.exe has the file “whatever.txt” open, let’s use Process Explorer to find the same information.
Run Process Explorer. It’ll open a window similar to this:
If you’ve used Process Explorer previously, it may open to a different set of default columns or sort order.
Click on the Find menu, and then the Find Handle or DLL… item. Open files are assigned what’s called a “handle” — a numeric identifier — hence the function name.2
This will open a small search dialog box.
Type the name of the file you’re looking for and click on Search. After some time (which varies depending on what else is happening on your computer at the moment), the list will be updated with the results.
As expected, Process Explorer shows us the full path to the file on the hard disk and which program has it open: Notepad.exe.
Refinements, issues, caveats
You don’t have to search for the full, exact filename if the filename is relatively unique. I could have searched for “what” or “whatever” and gotten similar results. At worst, you’ll get additional files listed that have the same string as part of their name. You may still be able to identify which one you’re looking for, but if not, you can simply re-run the search specifying more of the filename.
By default, Process Explorer will find only those files your signed-in account has access to. While this is usually enough to answer the “who’s got this file open” question, there are other scenarios where you might need or want to search everything. Running Process Explorer “as Administrator” (right-click on its icon and click Run as administrator) will allow it to do so.
In some cases, you’ll find results that list “System” or other unrecognized processes as having the file open.
What to do
So you’ve identified who has the file open. What next?
Well, the most obvious solution is to close the program you’ve identified as the culprit. In our example above, I’d close Notepad, and “whatever.txt” would be released.
The most common scenario I’ve seen is the Windows Search Indexer having the file open to process it. Simply wait a while and try again, and the issue is usually resolved. If you find other processes that you don’t recognize, don’t panic. Windows is complex, and there are many processes that could have the file open.
If you don’t recognize the program, a little cautious research might be called for. Research what you find in a Google search.3 More often than not, you’ll find that the process listed is a component of a program you do recognize, which can then be closed.
And finally, when all else fails, reboot. Then, before you do anything else, try to delete the file or whatever task you were trying to do that got you here.
Do this
The answer’s out there, and now, if Windows doesn’t tell you what program has the file open, you have a tool in the form of Process Explorer that should uncover the truth.
More answers are right here: subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.
Podcast audio
Footnotes & References
1: Highly unlikely, but I can dream.
2: Internally many, many, many things are assigned “handles” within Windows. Files are just one example.
3: Be careful with the results. Many “what’s this file” search results come in the form of “This might be a virus, buy our tool to clean it up.” Rule of thumb: if the page is trying to sell you something, it’s probably not reliable.
Well, you jumped to inputting the file name into the process explorer. What do you do if the initial “file in use” message doesn’t give the file name?
The it depends on what it was you were trying to do at the time specifically.
Before rebooting to close programs, I’ll log out of Windows and log in again. Logging out will close most programs. If logging out and in again doesn’t solve the problem, then I’ll reboot. I haven’t had to reboot in most cases.