How to find which program is locking a file in Windows
When Windows says a file is open in another program but doesn’t say which one, Resource Monitor (built into Windows) can find it in a minute. PowerToys File Locksmith, Process Explorer and TaskPilot can find it too, and close it.
The short answer
Press Windows + R, type resmon and press Enter. On the CPU tab, open Associated Handles and type the file’s name in the search box: the Image column shows the program that has it open. Close that program normally if you can. If it doesn’t close, right-click it there and choose End Process, which loses anything unsaved in it. Then delete, move or rename the file again.
Try the quick fixes first
- Close the program you last opened the file in, and check the taskbar and the notification area for one still running in the background.
- Turn off File Explorer’s preview pane (View › Preview pane) or details pane: a preview can keep a PDF, picture or Office file open.
- Wait a minute if the file is new or just downloaded: antivirus scanning, search indexing or cloud sync (OneDrive, Dropbox, Google Drive) may still be reading it.
- Sign out and back in, or restart Windows, if you just need the file free and don’t mind closing everything.
Method 1: Resource Monitor (built in)
- Press Windows + R, type
resmonand press Enter (or search for Resource Monitor). - Open the CPU tab and expand Associated Handles.
- Type part of the file or folder name in Search Handles. Every program holding it open appears, with its name (Image), process ID and the full path.
- Close that program normally. If it doesn’t respond, right-click it in the results and choose End Process.
Run Resource Monitor as administrator to also see programs that run as administrator or as a service.
Method 2: PowerToys File Locksmith
Microsoft’s free PowerToys includes File Locksmith. Once PowerToys is installed and File Locksmith is turned on, right-click the file or folder and choose Unlock with File Locksmith (on Windows 11 it may be under Show more options). It lists the processes using it and can end them. Use its Restart as administrator option to see processes that belong to administrators or other users.
Method 3: Process Explorer
Process Explorer from Microsoft Sysinternals shows every open handle. Choose Find › Find Handle or DLL (Ctrl + F), type the file name and pick a result: the process holding it is selected in the main window. You can end that process from there. Closing just the handle is possible too, but the program may crash or lose data, so close the program instead when you can.
Method 4: TaskPilot
TaskPilot, RSDWare’s free task manager for Windows 10 and 11, has a “Who’s using this file?” tool: pick the file you can’t delete or move and it shows the program that locks it, so you can close it. It also shows the whole process tree with CPU, memory, disk, GPU and network, and keeps 7 days of history of what slowed your PC down.
When the file is on a network share
If the file is on another PC or a server, the program holding it may be running on someone else’s computer. On the PC that shares the folder, open Computer Management › System Tools › Shared Folders › Open Files to see who has it open and close it there, after asking them to save their work.
Common questions
Is it safe to end the process?
Ending a program loses anything it hadn’t saved, and ending a Windows process can make the PC unstable until you restart. Prefer closing the program normally; end it only when it won’t close.
The file is locked by explorer.exe. What now?
Turn off the preview and details panes, close File Explorer windows showing that folder, or restart Explorer from Task Manager (or TaskPilot’s one-click Restart Explorer).
Nothing shows up, but the file is still locked.
Search again as administrator: programs running as administrator or as services are only listed then. A restart frees every lock as a last resort.