Can’t delete a file? Here’s how to truly remove it

Sometimes Windows prevents you from deleting a file because it is “in use” or locked by a hidden process. In this guide, I’ll show you how to truly delete it, even if it won’t delete with the right-click. You only need a few minutes and free tools: no risk, even for less experienced users.

Persona che cerca di cancellare un file da Windows usando il menu contestuale - Foto RisAI

There are several reasons why a file cannot be deleted on Windows:

  • It is open in a program that is using it (e.g. Word, VLC, Photoshop)
  • It is locked by a background process
  • You have limited privileges (e.g. system file or protected by administrator rights)
  • It is corrupted or has a name that is too long

The result is always the same: Windows tells you the file is “in use” or that “you can’t complete the operation.” But there are solutions.

Method 1 – Restart your PC and try again

It may seem trivial, but a simple restart closes all active processes that might be using the file. After restarting, try deleting it immediately before opening other programs.

Method 2 – Delete the file in Safe Mode

Safe Mode starts Windows with the bare minimum. Here’s how to use it:

  1. Press Win + R, type msconfig and press Enter
  2. Go to “Startup Options” and check “Safe Mode”
  3. Restart your PC and boot into Safe Mode
  4. Locate the file and delete it
  5. Return to msconfig and uncheck Safe Mode

Method 3 – Use Command Prompt

If the file is stubborn, you can use Command Prompt as administrator:

  1. Type “cmd” in Windows search, right-click Command Prompt > “Run as administrator”
  2. Type the command:
    del "C:\Percorso\Del\File.txt"
  3. Press Enter

Remember to use quotes if the path contains spaces.

Method 4 – Unlock the file with LockHunter

LockHunter is a free program that shows you what is locking the file and allows you to force deletion.

  • Install LockHunter
  • Right-click the file > “What is locking this file?”
  • Close the process or force deletion

Method 5 – Use Explorer++ in administrator mode

Explorer++ is an advanced file manager. If you run it in administrator mode, you can often delete locked or protected files.

Method 6 – Rename the file or change its extension

Sometimes renaming a file allows you to unlock it. Try this:

  1. Right-click the file > “Rename”
  2. Add a suffix, e.g.: file.txt.old
  3. Try deleting it

Method 7 – Check the file permissions

If you receive “access denied” messages, you might not have the correct permissions:

  1. Right-click > “Properties” > “Security”
  2. Click “Edit” and assign full permissions to the current user
  3. Apply > OK, then try to delete

Method 8 – Delete files with too long names

Windows has a 260 character limit on file paths. To work around this:

  • Rename the “parent” folders to shorten the path
  • Or use Command Prompt with:
    \\?\C:\Percorso\Molto\Lungo\file.txt

Method 9 – Force empty the Recycle Bin

If the file is in the Recycle Bin and won’t delete:

  1. Open Command Prompt as administrator
  2. Type: rd /s /q %systemdrive%\$Recycle.bin
  3. Restart

Conclusion

A file that won’t delete can seem like a frustrating obstacle, but with the right tools you can safely remove it, even if it is locked or protected. The methods described above work in the vast majority of cases. I recommend starting with the simplest (restart, safe mode), then move on to advanced tools like LockHunter or Command Prompt.

Deleting stubborn files is one of the most searched operations on Windows. Now you know exactly how to do it, step by step.

Scroll to Top