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:
- Press Win + R, type
msconfigand press Enter - Go to “Startup Options” and check “Safe Mode”
- Restart your PC and boot into Safe Mode
- Locate the file and delete it
- Return to
msconfigand uncheck Safe Mode
Method 3 – Use Command Prompt
If the file is stubborn, you can use Command Prompt as administrator:
- Type “cmd” in Windows search, right-click Command Prompt > “Run as administrator”
- Type the command:
del "C:\Percorso\Del\File.txt" - 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:
- Right-click the file > “Rename”
- Add a suffix, e.g.:
file.txt.old - Try deleting it
Method 7 – Check the file permissions
If you receive “access denied” messages, you might not have the correct permissions:
- Right-click > “Properties” > “Security”
- Click “Edit” and assign full permissions to the current user
- 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:
- Open Command Prompt as administrator
- Type:
rd /s /q %systemdrive%\$Recycle.bin - 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.










