Windows

Can't Delete or Rename a File 'Open in Another Program' on Windows? Here's the Fix

Published ✓ Verified ⏱️ 3 min read February 27, 2025 · by Ryan Bennett

You try to delete or rename a file and Windows blocks it with “The action can’t be completed because the file is open in another program.”

Why: a file can’t be deleted while a process is holding an open handle to it — Microsoft’s guidance is to find the process that has the handle and close it. Often the culprit is invisible: a background app, COM Surrogate (dllhost.exe) drawing a thumbnail, or even File Explorer itself if the folder is pinned to Quick access. Resource Monitor names the exact process.

Fix 1: Close the obvious app (and empty the Recycle Bin)

  1. Close any program that recently opened the file — media players, Office, photo viewers, and PDF apps keep files locked.
  2. If you can’t even close it, that app may be minimized to the system tray — right-click its tray icon and Exit.
  3. If the file used to be open from the Recycle Bin or a preview, empty the Recycle Bin and try again.

Fix 2: Find the locking process with Resource Monitor

This is the reliable fix when nothing seems to have the file open:

  1. Press Win + R, type resmon, and press Enter.
  2. Go to the CPU tab.
  3. In the Associated Handles section, click the search box and type the file name (or part of it) you’re trying to delete.
  4. Any process holding it open appears in the list. Right-click that process → End Process.
  5. Now delete or rename the file. (If it’s dllhost.exe / COM Surrogate, it’s just generating a thumbnail — ending it is safe and it restarts on its own.)

Fix 3: Unpin the folder or close the Preview pane

File Explorer can be the one holding the handle:

  • If you’re renaming a folder that’s pinned to Quick access, right-click it → Unpin from Quick access first, then rename it.
  • Turn off the Preview pane (in File Explorer: View → Preview pane to toggle it off) — it opens the selected file to preview it, which locks it.

Fix 4: Close the handle by restarting Explorer or the PC

If you can’t identify the process, force everything to release the file:

  1. Open Task Manager (Ctrl + Shift + Esc), right-click Windows Explorer → Restart, then try again.
  2. Still stuck? Restart the PC — this releases every open handle, after which the file deletes normally. If it still won’t go, the file may have a permissions issue or a corrupt file system (run chkdsk and check ownership).

FAQ

The handle search shows COM Surrogate (dllhost.exe). Is it safe to end it? Yes. COM Surrogate runs thumbnail/preview generators in a sandbox; ending it just stops the preview and Windows relaunches it as needed. The file then deletes.

It deletes after a reboot every time — why? A background app is grabbing the file at startup. Use Resource Monitor (Fix 2) right after the error to see which process, then stop it from auto-starting (Task Manager → Startup apps).

Sources: Microsoft Learn — Can’t delete a file or a folder on an NTFS file system · Microsoft Support — Error: Windows Explorer has stopped working

↑↓ navigate · ↵ open · Esc close See all results →