Skip to content

Tool Tutorials

How to Delete a File That Is Open in Another Program (Windows 11 and 10)

ScanWith Team 5 min read
How to Delete a File That Is Open in Another Program (Windows 11 and 10)

Windows refuses to delete, move or rename a file while another program still has it open.

The message reads "The action can't be completed because the file is open in another program" or "The process cannot access the file because it is being used by another process".

These seven fixes are ordered from the gentlest to the most forceful, so start at the top.

Why Windows locks a file

When a program opens a file it can ask Windows to keep everyone else away until it is done. That protects a document from being deleted halfway through a save.

The lock normally disappears when the program closes the file. It stays when the program is still running in the background, has crashed without letting go, or is a service you never see.

1. Close the program named in the message

Windows often names the culprit in the dialog, for example "open in Microsoft Word". Save your work, close that program completely and click Try Again.

Check the notification area next to the clock as well. Media players, sync tools and chat apps keep running there after their window is closed.

2. Turn off the preview pane in File Explorer

File Explorer itself locks PDFs, pictures and videos while it shows them in the preview pane. Press Alt+P in the Explorer window to switch the pane off, then delete the file.

3. Restart Windows Explorer

Press Ctrl+Shift+Esc to open Task Manager. On the Processes tab, select Windows Explorer and click Restart.

The taskbar disappears for a second and comes back. Thumbnail and preview locks are gone afterwards.

4. Find the program with Resource Monitor

When the message does not name a program, Windows can still tell you which one it is.

  1. Press Win+R, type resmon and press Enter.
  2. Open the CPU tab and expand Associated Handles.
  3. Type part of the file name into the search box.
  4. Right-click the process that appears and choose End Process.

Our guide on finding which process is locking a file covers this and four other methods in detail.

5. Unlock the file with File Unlocker

A dedicated tool does the search and the cleanup in one step. ScanWith File Unlocker is a free, portable file unlocker for Windows 11 and 10 - one file, nothing to install.

  1. Download it and start it as administrator.
  2. Drag the stubborn file or folder into the window.
  3. Read the list of programs shown under the file.
  4. Click Recycle to close those programs and send the file to the Recycle Bin, or Unlock to only release it.
ScanWith File Unlocker listing a locked file with the programs that hold it open

It asks before it closes anything and never touches critical system processes. It also handles many files at once, which Resource Monitor cannot do.

6. Delete it from the Command Prompt

Some locks belong to Explorer only. Open Command Prompt as administrator and run del /f "C:\path\to\file.ext", with the real path between the quotes.

For a folder use rd /s /q "C:\path\to\folder". Double-check the path first, because neither command uses the Recycle Bin.

7. Restart, or delete at the next restart

A restart closes every program and clears almost every lock. Delete the file right after signing in, before you open anything else.

If a service grabs the file again during startup, schedule the deletion instead. In File Unlocker choose Actions and then "Delete at next restart", and Windows removes the file before any program can lock it.

Keeps coming back? A file that is locked by a program you do not recognise, or that reappears after you delete it, deserves a malware check. See what to do when a file won't delete.

Frequently asked questions

Is it safe to force-delete a file that is in use?

For your own documents, downloads and media, yes. Leave files in C:\Windows and C:\Program Files alone unless you know exactly what they are.

Will I lose unsaved work?

Only in the program that gets closed. Ending a process skips its "Save changes?" question, so save first whenever you can.

Why does "Access is denied" appear instead?

That is a permission problem, not a lock. Run the tool or Command Prompt as administrator, or take ownership of the file in its Properties, Security tab.

WindowsLocked filesFile Unlocker

Related guides