Every Windows user has at least once encountered a situation where, when trying to delete an old file, a temporary folder, or leftover program data, the system throws an error: “The file is already in use by another program,” “Access denied,” or “You need permission from Administrator.”
This usually happens because a system process or background service forgot to release the file. In this guide, we’ll walk through three proven methods to safely and forcibly delete undeletable files in Windows 10 and Windows 11.
Method 1. End the Process via Task Manager
Most often, an application that continues running in the background even after closing its main window prevents you from deleting a file.
-
Press Ctrl + Shift + Esc to open Task Manager.
-
Go to the Processes tab and find the application associated with the file (for example, a browser, torrent client, or graphics editor).
-
Right-click the process and select “End task.”
-
Try deleting the file again or emptying the Recycle Bin.
If the file continues to be blocked, restart the system shell: find “Windows Explorer” in the process list, right-click it, and select “Restart.”
Method 2. How to Delete Undeletable Files via Command Prompt
If the graphical interface doesn’t work, you can use built-in system commands with the force-delete switch (/f).
-
Right-click the Start button and select “Terminal (Admin)” or search for “Command Prompt,” then run it as administrator.
-
To force-delete a single file, enter the command:
del /f /q /a "C:\path\to\filename.ext" -
If you need to forcibly erase a stubborn folder with all its contents, run:
rd /s /q "C:\path\to\folder" -
Press Enter. The commands execute instantly without prompting for Recycle Bin confirmation.
Method 3. Using LockHunter or IObit Unlocker
If you don’t know which process is holding the file, specialized free utilities can help. One of the best and safest solutions is LockHunter.
-
Download and install the utility from the official developer website.
-
Right-click the file or folder that won’t delete and select “What is locking this file?”
-
In the window that opens, the program will show the exact list of processes and services blocking access.
-
Click “Unlock It!” to release the lock or “Delete It!” to delete the object directly from the program interface.
What to Do If Nothing Works
In rare cases, files are locked by drive corruption. If these methods didn’t help you delete undeletable files, try the following steps:
-
Run a disk check: open Command Prompt as administrator and enter the command
chkdsk chkdsk C: /f /r, then restart your computer. -
Or boot into Safe Mode, where third-party background services are disabled, and delete the file through the regular File Explorer.
For homelabs, remote testing, and staging environments, we run NVMe VDS instances on Erahost. Fast provisioning, European routing, and predictable I/O.
View NVMe Plans →