This article explains why some files refuse to be deleted and gives you seven practical fixes that usually work, from closing the program that is using the file to using a command-line tool. You will learn the most likely causes and the exact steps to try, in order from safest to most forceful.
Why a File Becomes Undeletable
A file is undeletable when Windows (or your operating system) cannot remove it because something is holding it open, or because the file system itself has a problem. The most common reasons are:
- The file is open in a program – a document in Word, a video in a player, or a photo in an editor.
- The file is locked by a background process – antivirus scanning, a cloud-sync app (OneDrive, Google Drive), or a search indexer.
- The file is in use by the system – a system file that Windows needs, or a file in a protected folder like Program Files.
- Permission issues – your user account does not have the right to modify or delete the file.
- Corrupted file system – the disk has errors that make the file appear locked or unreadable.
- File name or path is too long – Windows has a 260-character limit for file paths (unless long-path support is enabled).
Knowing which cause applies to your file helps you pick the right fix. The steps below cover all of them.
Fix 1: Close the Program Using the File
Most of the time, the file is simply open in a program. Close all visible windows first. Then check for background processes:
- Press Ctrl+Shift+Esc to open Task Manager.
- Under Processes, look for the app that might be using the file (e.g., Word, Excel, VLC, Photoshop).
- Select it and click End task.
- Try deleting the file again.
If you do not know which program is using it, use the Process Explorer tool from Microsoft (free) – it has a search feature that finds which process has a file open. Or try the next fix, which often reveals the culprit.
Fix 2: Use the Command Line to Delete
The command line can sometimes delete files that Explorer cannot, because it bypasses some Explorer-specific locks. Open Command Prompt as administrator (type cmd in the Start menu, right-click, and choose Run as administrator), then use:
del /f /q "C:\full\path\to\file.ext"
The /f forces deletion of read-only files, and /q suppresses confirmation. If the path has spaces, you must put it in quotes. For a folder, use rmdir /s /q "C:\path\to\folder".
If the file is locked by a process, the command will fail with a message like “The process cannot access the file because it is being used by another process.� That tells you the file is genuinely locked, and you need to find and stop the process.
Fix 3: Take Ownership and Grant Permissions
If you get an “Access Denied� error, your account lacks permission. To take ownership of a file or folder:
- Right-click the file (or folder) and choose Properties.
- Go to the Security tab and click Advanced.
- Next to Owner, click Change.
- Type your username, click Check Names, then OK.
- Check the box Replace owner on subcontainers and objects (if it is a folder).
- Click OK, then in the Security tab, click Edit and give your account Full control.
- Try deleting again.
This works for files that were created by another user or after a system migration.
Fix 4: Use Safe Mode
Safe Mode starts Windows with only essential drivers and services, so many background programs (antivirus, cloud sync, indexers) do not load. That often releases the lock.
- Restart your PC and press F8 (or Shift+Restart) to get into the boot menu.
- Choose Safe Mode (or Safe Mode with Networking if you need internet).
- Try to delete the file.
If it deletes in Safe Mode, the culprit is a startup program. You can then use msconfig (System Configuration) to disable suspicious startup items and find the exact one.
Fix 5: Check for Disk Errors
If the file is on a drive with corrupted sectors, Windows may treat it as locked. Run a disk check:
- Open Command Prompt as administrator.
- Type
chkdsk C: /f(replace C: with the drive letter). - If the drive is in use, you will be asked to schedule it for next restart – type Y and restart.
This scans and repairs file system errors. It can take a while on large drives. After it finishes, try deleting the file again.
Fix 6: Use a Third-Party Unlocker Tool
If none of the above works, a dedicated “unlocker� tool can force-close the handle and delete the file. Popular free options include LockHunter and IObit Unlocker. These tools are safe when downloaded from official sites, but be cautious about bundled adware. The general steps are:
- Install the tool.
- Right-click the file and choose the tool’s option (e.g., “What is locking this file?�).
- It will list the processes that have the file open.
- Choose to unlock or delete the file.
These tools are more powerful than the command line because they can terminate the locking process automatically. Use them only for files you are sure are not system-critical.
Fix 7: Delete After Restart (or from Another OS)
If a file is locked by a system service that restarts, you can schedule deletion for the next boot. In Command Prompt (admin), use:
del /f "C:\path\to\file" && shutdown /r /t 0
But that restarts immediately. A safer way is to use a startup script or simply restart and delete the file immediately after login, before other programs start. If the file is on a non-system drive, you can boot from a USB drive with a live Linux distribution and delete it from there – this bypasses Windows entirely. That is a last resort, but it works for almost anything except files on a physically failing drive.
Frequently Asked Questions
Why does it say “file is open in another program� when it is not?
This message appears when a background process (like an antivirus scanner or a cloud sync client) has the file open, even if you do not see a window. Use Task Manager or a tool like Process Explorer to find the process, or try Safe Mode.
Can I delete a file that is in use by the system?
System files that are essential to Windows (like those in the System32 folder) cannot be deleted while Windows is running. If you are sure you want to remove one (for example, a leftover driver), you need to boot from a recovery environment or a live USB, but be careful – deleting system files can break your OS.
What if the file is read-only?
Right-click the file, go to Properties, and uncheck Read-only at the bottom. Then try deleting. The command line with /f also overrides read-only.
Is it safe to use third-party unlocker tools?
They are generally safe if you download from the official website and avoid bundled offers. However, they force-close processes, which could cause data loss in an unsaved document. Always save your work first.
What if the file is on an external drive or USB stick?
Try plugging it into a different port, or use a different computer. If the drive is formatted as exFAT or FAT32, permissions are not the issue – the file is likely open or the drive is failing. Run chkdsk on that drive.
What if the file name is too long?
Windows has a 260-character path limit. To delete such a file, you can shorten the path by renaming parent folders, or use the \?\) prefix in the command line: del "\\?\C:\very\long\path\file.txt". Alternatively, enable long paths in the Windows registry (search for “Enable NTFS long paths�).
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Philips DST7060/20 7000 Series Iron: Specs & Fit
- Coal Fueled Jet Aircraft: Could It Work?675 L
- Remote Desktop on Raspberry Pi: How to Enable It
- Word Select Last Line in Paragraph?
- Google Assistant IFTTT Recipes: 7 Useful Automations
- OLED TVs in Dark Rooms: Why They Look Better and When They Don’t