Safe to Delete

How to Force Delete a Locked File or Folder in Windows 11 / 10

Quick Answer: Fix 'The action cannot be completed because the file is open in another program' with Command Prompt, PowerShell, and Task Manager.

Bottom Line: When Windows displays the error “The action cannot be completed because the file or folder is open in another program”, an active process or background system service holds an active file handle. You can force unlock and permanently delete the locked file using Resource Monitor, Command Prompt, or PowerShell.


Why Does Windows Lock Files?

Windows implements file locking mechanisms to prevent data corruption. If a program (such as Word, Photoshop, or a background updater) has a file open, Windows locks the file from being renamed, moved, or deleted until the process releases the handle.


3 Methods to Force Delete Locked Files in Windows

Method 1: Unlock via Resource Monitor (No Restart Required)

  1. Press Win + R, type resmon.exe, and press Enter.
  2. Select the CPU tab.
  3. In the Associated Handles search bar, type the exact name of the locked file or folder.
  4. Resource Monitor will list the process holding the handle (e.g. explorer.exe, chrome.exe, node.exe).
  5. Right-click the process and select End Process.
  6. Delete your file normally in File Explorer.

Method 2: Force Delete via Command Prompt (Admin)

If Windows Explorer is holding the file lock:

  1. Press Win + X and select Terminal (Admin) or Command Prompt (Admin).
  2. Terminate Windows Explorer temporarily to release file locks:
taskkill /F /IM explorer.exe
  1. Delete the locked file permanently (/f forces deletion, /q enables quiet mode):
del /f /q /a "C:\path\to\locked-file.ext"
  1. Restart Windows Explorer:
start explorer.exe

Method 3: Force Delete via PowerShell Command

  1. Open PowerShell as Administrator.
  2. Run the Remove-Item command with the -Force parameter:
Remove-Item -Path "C:\path\to\locked-folder" -Force -Recurse

Frequently Asked Questions (FAQ)

What if Windows says “Access is Denied” when trying to force delete?

If you receive “Access is Denied”, your user account lacks file ownership permissions. Right-click the file > Properties > Security > Advanced > Change Owner to your user account, then check Full Control.


Discussion

Loading authentication...

Related in windows

Chia Blockchain Mainnet Database (~/.chia/mainnet/db)

The Chia mainnet db folder stores full node blockchain blocks (blockchain_v2_mainnet.sqlite). Deleting forces re-sync.

Use Caution

Why Is My Hard Drive Full But No Files Are Showing? (Hidden Bloat Solved)

Fix hard drives that appear full despite selecting all files showing low storage. Discover hidden shadow copies, System Volume Information, and pagefiles.

Safe to Delete

The Windows 11 Master Storage Cleanup Compendium: Free Up 150GB Safely

The definitive 2,200-word master guide on what files and folders are safe to delete on Windows 11 to free up space without breaking your operating system.

Safe to Delete
Back to all files