How to fix Error 16 on Windows 11

Why This Error Happens

Error 16 (ERROR_CURRENT_DIRECTORY) occurs when Windows attempts to delete a folder that is currently set as the active/working directory for a running process, such as Command Prompt, PowerShell, or an open application. It can also occur if a file handle inside that directory is still locked by File Explorer, an antivirus scanner, or a background service. Because Windows won’t let a process delete the directory it’s actively “standing in” or referencing, the removal request fails until that lock is released.

Step-by-Step Resolution Guide

  1. Close all terminals and apps pointing to that folder
    Close every open Command Prompt, PowerShell, or Windows Terminal window, as well as any File Explorer windows currently browsing inside the target directory.

  2. Change directory before deleting (if using CLI)
    If you’re deleting via script or terminal, ensure you cd out of the folder first:

   cd C:\
   rmdir /s /q "C:\Path\To\Folder"

Never run a delete command while your shell’s current path is inside the folder you’re removing.

  1. Check for locked files using Resource Monitor
  • Press Win + R, type resmon, and hit Enter.
  • Go to the CPU tab → Associated Handles.
  • Search for the folder name and end any process holding a handle to it.
  1. Use Process Explorer to find hidden locks
    Download Sysinternals Process Explorer, use Find > Find Handle or DLL, search the folder path, and close the identified process.

  2. Force delete via Safe Mode (last resort)
    Restart Windows 11 into Safe Mode (Settings > System > Recovery > Advanced Startup > Restart Now > Troubleshoot > Advanced Options > Startup Settings > Safe Mode), then delete the folder — this ensures no background apps or services are holding a lock.

Alternative or Verification Steps

  • After deletion, run dir "C:\Path\To\Folder" in Command Prompt — if it returns “File Not Found,” the removal was successful.
  • If the issue persists, try deleting the folder using a bootable Windows PE / recovery USB, which bypasses all Windows-session file locks entirely.