How to Force Delete a File in Windows 11 (6 Ways)

To force delete a file in Windows 11, first close whatever program is using it, then try again. If File Explorer still refuses, open Terminal (Admin) and run del /f /q “C:\path\to\file.txt” to delete a file, or rmdir /s /q “C:\path\to\folder” to delete a folder and everything inside it. For files that say “You need permission,” take ownership first with takeown and icacls, and for stubborn locked files, restart in Safe Mode and delete them there.

Deleting from the command line skips the Recycle Bin, so double-check the path before pressing Enter. Below are the methods in order, from simplest to most powerful.

1. Find and close the program using the file

The most common error is “The action can’t be completed because the file is open in another program.”

  1. Close any app that might have the file open, such as Word, a video player or a game.
  2. If you’re not sure which program it is, press Windows key + R, type resmon, and press Enter to open Resource Monitor.
  3. On the CPU tab, type the file name in the Associated Handles search box.
  4. Right-click the process holding the file and choose End Process, or close it normally.
  5. Try deleting the file again.

File Explorer’s preview pane can also lock files. Turn it off with View > Show > Preview pane.

2. Restart and delete

Restarting closes everything that might be using the file. Delete it right after signing back in, before opening other apps.

3. Delete with Command Prompt or Terminal

  1. Right-click Start and choose Terminal (Admin). If it opens PowerShell, you can still use these commands, or open a Command Prompt tab.
  2. To delete a file: del /f /q “C:\Users\You\Downloads\stuck-file.zip”
  3. To delete a folder and its contents: rmdir /s /q “C:\Users\You\Downloads\stuck-folder”

Tip: In File Explorer, select the file and press Ctrl + Shift + C to copy its full path, then paste it into the command.

4. Take ownership of the file

If you see “You require permission from TrustedInstaller” or “Access is denied”:

  1. Open Terminal (Admin).
  2. Run takeown /f “C:\path\to\folder” /r /d y to take ownership.
  3. Run icacls “C:\path\to\folder” /grant administrators:F /t to give administrators full control.
  4. Delete the file or folder.

Don’t do this to files in the Windows or Program Files folders unless you’re sure they’re safe to remove. Deleting system files can break Windows.

5. Delete in Safe Mode

  1. Go to Settings > System > Recovery and click Restart now next to Advanced startup.
  2. Choose Troubleshoot > Advanced options > Startup Settings > Restart, then press 4.
  3. Delete the file in File Explorer or with the commands above, then restart normally.

Safe Mode is useful for files locked by malware or background services.

6. Delete files with very long paths

Folders nested too deeply can give “file name too long” errors. Rename parent folders to short names like “a” and “b” to shorten the path, then delete. Or run rmdir /s /q “\\?\C:\long\path”, which supports long paths.

Choose the right method

Error Try
File is open in another program Close the app, Resource Monitor, or restart
Access is denied / need permission Run as admin, takeown and icacls
Could not find this item Command line del or rmdir, or check for trailing spaces in the name
File name too long Shorten parent folder names or use the \\?\ prefix
Locked by malware Safe Mode and a Windows Security scan

Related: remove Windows from a hard drive.

Related: wipe an SSD in Windows.

Frequently asked questions

Where do force-deleted files go?

Files deleted with del, rmdir or Shift + Delete don’t go to the Recycle Bin. Recovering them requires backups or recovery software.

Is it safe to force delete files?

Yes, for your own files. Be careful with system folders and program files, which Windows and apps need.

Why does a deleted file come back?

A sync app like OneDrive may restore it from the cloud, or a program recreates it. Delete it from the cloud too, or close the program.