ContextCleaner: see every entry in the Windows 11 right-click menu, and which app added it — on the Microsoft Store.
Guide LockGhost

File in Use on Windows: How to Find What Is Locking a File or Folder and Release It

Fix "file in use" and "cannot delete" errors on Windows: find the process locking a file or folder, decide if it is safe to close, and release the lock.

Published October 28, 2026 13 min read

When Windows says a file is in use, some running process has the file or folder open, and Windows will not let you delete, move or rename it until that process lets go. To find out which one, open Resource Monitor (press Win+R, type resmon), go to the CPU tab, and type the file name into the Associated Handles search box. The result shows the process holding it. Close that program normally, wait for a sync or scan to finish, or, if it is a process you understand, end it. If the holder is a Windows system process, restart instead of ending it.

This guide explains what the error means, how to find the locking process, when it is safe to end it, which programs usually cause locks, why empty folders and USB drives get stuck, and which built-in and free tools help. Each section links to a deeper guide on this site.

What does “the action can’t be completed because the file is open in another program” mean?

Programs open files with sharing rules. A program can say “others may read this file while I have it open, but nobody may delete or write to it”. While that handle is open, Windows enforces the rule, and Explorer shows a message such as:

  • “The action can’t be completed because the file is open in another program.”
  • “The process cannot access the file because it is being used by another process.” (error 32)
  • “The process cannot access the file because another process has locked a portion of the file.” (error 33, often shown as 0x80070021)
  • “Access is denied” or “You need permission to perform this action”, which sometimes means a lock and sometimes means a real permission problem.

The lock is not damage. It goes away as soon as the program closes the file or exits. File being used by another process: error 32 explained covers the most common wording, and error 0x80070021 covers the locked-portion variant. Copy tools show the same thing in their own way; see Robocopy ERROR 32.

Lock or permission problem?

It helps to tell the two apart before you go hunting. A lock is temporary: the same action works after you restart, sign out or close the right program. A permission problem stays after a restart, and the file’s Properties, Security tab shows your account lacks the right access. If the error survives a clean restart with nothing else running, check permissions, ownership and whether the file is marked read-only before looking for a process.

How do I find which process is locking a file?

Resource Monitor is built into every copy of Windows and is the quickest free answer.

  1. Open Resource Monitor. Press Win+R, type resmon and press Enter.
  2. Go to the CPU tab and expand Associated Handles.
  3. Search for the file or folder name in the search box next to Associated Handles. Part of the name is enough.
  4. Read the Image column. It shows the program name and PID holding a handle that matches.
  5. Close that program normally. Save your work in it and quit. If it is a background process, see the next section before ending it.
  6. Try the action again. If the lock was the only problem, delete, move or rename now works.

If the search returns nothing, run Resource Monitor as administrator, since processes running as another user may not show. Some locks are held by drivers or the kernel and do not appear as an ordinary handle.

The openfiles command looks promising but mainly shows files opened by other people over a shared folder. For local files it shows nothing until an administrator turns on a global flag with openfiles /local on and restarts, and Microsoft notes this can slow the system. openfiles command: see which files are open on Windows explains when it helps.

Using Process Explorer instead

Process Explorer from Microsoft Sysinternals is a free download that gives a more detailed view. Run it, use its find feature to search handles and DLLs, type part of the file name and search. Each result shows the process and the exact handle. Double-click a result to jump to that process in the main list, where you can see its full path, its parent process and the account it runs as. That context helps when several copies of the same program are running, such as several node.exe or dotnet.exe processes, and you need the one that holds the file.

Is it safe to end that process?

It depends on what the process is.

  • Your own app (Word, Excel, a text editor, a media player): save your work and close it. Ending it forcefully can lose unsaved changes.
  • A sync or backup client (OneDrive, Dropbox, a backup tool): let it finish or pause it. Ending it mid-sync can leave a partial copy.
  • Antivirus: wait a minute. Scans release files when they finish. Do not end security software to get around a lock.
  • Explorer (explorer.exe): usually safe to restart from Task Manager. The taskbar disappears and comes back.
  • Build tools and IDEs: stop the build or the debugger. MSB3027 could not copy covers the Visual Studio case.
  • System, svchost.exe, csrss.exe, wininit.exe or other core Windows processes: do not end them. Restart Windows instead.

Installers hit the same problem when they need to replace a file that is in use, which is why they ask you to close apps first. See applications should be closed before continuing the install.

The usual suspects: OneDrive, antivirus, Explorer previews, search indexing and dev tools

Most locks come from a short list of programs.

SuspectWhy it holds filesWhat to do
OneDrive and other sync clientsUploading or downloading the fileWait, or pause sync briefly
AntivirusScanning a new or changed fileWait for the scan to finish
Explorer preview pane and thumbnailsRendering a preview of the selected fileTurn off the preview pane, select another file, or restart Explorer
Windows Search indexerReading files to index themWait; it releases files quickly
Office appsDocument open, sometimes in a hidden instanceClose the app; check Task Manager for leftover instances
IDEs, compilers and dev serversOutput files, logs and watched foldersStop the build, debugger or watcher
Media playersPlaying or previewing a fileClose the player

Temporary files are a frequent source of stuck deletes, because many programs keep temp files open while running. %temp% in Windows: open and clear the temp folder safely explains which ones you can skip.

Locks that come back after every restart

If a file is locked again straight after you sign in, the holder starts with Windows. Look at startup apps in Task Manager (Startup apps), services set to start automatically, and scheduled tasks. Mail clients that keep a data file open, such as Outlook with a PST file, sync clients and backup agents are common examples. Close or pause the program, do what you need to the file, then start it again. For files that are in use by Windows itself, the safe route is to let the owning program or an update replace them at the next restart rather than forcing the issue.

Why can’t I delete a folder that looks empty?

A folder can be locked even when it looks empty, for several reasons:

  • A program has the folder itself open as its working directory. A terminal, a command prompt or a dev server started inside that folder holds it. Change directory or close the window.
  • Hidden files inside. Turn on hidden items in Explorer (View, Show, Hidden items) and look again. Files such as desktop.ini or Thumbs.db can sit there unseen.
  • Explorer itself. An Explorer window open on the folder, or the preview pane, can hold a handle. Close the window or move up one level.
  • A file deep inside a subfolder. Search for the folder path, not just its name, in Resource Monitor’s Associated Handles box. Any open file below it blocks deletion of the whole tree.

Why won’t my USB drive eject?

“This device is currently in use” when ejecting a USB drive is the same problem at drive level: some process has a file or folder on the drive open. Explorer windows on the drive, a document opened from it, antivirus scanning it, or the search indexer are common causes. Close those, then try again. Search for the drive letter (for example E:\) in Resource Monitor’s Associated Handles box to see what holds it.

If you still cannot find the holder, signing out or restarting releases everything. USB drive currently in use? find what blocks eject has the full steps. Pulling the drive while files are open risks data loss, so avoid it.

Built-in and free tools: Resource Monitor, openfiles, Process Explorer and PowerToys File Locksmith

You may not need anything extra. Here is how the options compare.

ToolCostHow you use itNotes
Resource MonitorBuilt inSearch Associated Handles by nameWorks everywhere; run as administrator for full results
openfilesBuilt inCommand lineMainly for files opened over a network share; local tracking needs a flag and a restart
Process Explorer (Sysinternals)FreeSearch handles and DLLs by nameDetailed, aimed at technical users
PowerToys File LocksmithFreeRight-click in ExplorerPart of the PowerToys suite
LockGhostOne-time purchaseExplorer-friendly workflowStandalone, with guardrails and lock history

PowerToys File Locksmith is a good free choice if you already use PowerToys. According to Microsoft’s documentation, after you turn it on in PowerToys you right-click a file or folder in Explorer (on Windows 11, under Show more options) and choose Unlock with File Locksmith. It lists the processes using the selected items, scanning folders recursively, and offers an End task button for each. Processes run by other users may be missing unless you choose Restart as administrator. It also has a command-line tool with options to output JSON, wait for a file to be released, or end the processes holding it, which is handy in scripts.

PowerToys File Locksmith vs LockGhost compares the two in detail, and the file unlocker for Windows 11 covers what LockGhost is built for.

How LockGhost fixes this

LockGhost is a standalone file unlocker for Windows 11. Its Microsoft Store listing describes:

  • The process behind the error: it shows which process is behind “file in use”, “access denied” and “cannot delete file” errors, for both files and folders.
  • Explorer-friendly workflow: start from the file or folder you are stuck on.
  • Clear lock information: friendly app names rather than only raw process names, so you can tell what is holding the file.
  • Guardrails: it helps you avoid ending critical system processes, and lets you act only once you understand what is blocking the file.
  • Local lock history: keep track of what has locked files before.
  • Private and offline: no cloud account, no subscription and no telemetry.

LockGhost is a one-time purchase on the Microsoft Store.

Get LockGhost from the Microsoft Store

Frequently asked questions

How do I delete a file that says it is open in another program?

Find the program holding it with Resource Monitor’s Associated Handles search, close that program, then delete the file. If a system process holds it, restart Windows and try again.

Can I unlock a file without ending the process?

Usually not safely. Forcing a single handle closed can corrupt data or crash the program. Closing the program or waiting for it to finish is the safe route.

Why does OneDrive keep locking my files?

It holds files while it uploads or downloads them. Wait for sync to finish, or pause sync briefly while you rename or move the file.

Is PowerToys File Locksmith enough?

For many people, yes. It is free and shows which processes use a file from the Explorer menu. A standalone tool suits you if locks are a regular problem and you want guardrails and history.