Dealing with corrupted files can be frustrating. You may try deleting them, only to get an error message that the file cannot be deleted. Fortunately, there are a few tricks you can use to force the deletion of corrupted files in Windows.
Quick Answers
Here are some quick answers to common questions about forcing deletion of corrupted files:
- Use the Command Prompt or PowerShell to delete files that won’t delete through Windows Explorer.
- Restart your computer in Safe Mode to delete corrupted files.
- Use the DEL or ERASE command in Command Prompt to force deletion.
- Unlock or take ownership of the file if you get an “Access Denied” error.
- Scan for viruses/malware that may be causing the file corruption.
Use Command Prompt or PowerShell
One of the simplest ways to force deletion of a corrupted file is to use Command Prompt or PowerShell instead of trying to delete through Windows Explorer. Command Prompt and PowerShell give you more control over file operations.
To delete a file with Command Prompt or PowerShell:
- Open the Start menu and search for “Command Prompt” or “PowerShell”. Right-click and select “Run as Administrator”.
- Navigate to the folder containing the corrupted file. For example, to navigate to the Windows folder, type
cd C:\Windows
and press Enter. - Type the command
del filename
orerase filename
where “filename” is the name of the corrupted file. - Press Enter. The file should now be deleted.
The DEL and ERASE commands force deletion even if Windows Explorer gives you an error when trying to delete the file. Just be cautious when deleting system files in case you delete something important accidentally.
Restart in Safe Mode
Restarting your computer in Safe Mode can allow you to delete corrupted files that you can’t delete in normal mode. Safe Mode loads only the essential drivers and services, which prevents applications or malware from locking the file.
To restart in Safe Mode and delete corrupted files:
- Open the Start menu and click the Power button.
- Hold down the Shift key while clicking “Restart”.
- On the recovery screen, select “Troubleshoot”.
- Select “Advanced options”.
- Click “Startup Settings” and then “Restart”.
- After your PC restarts, select Safe Mode by pressing 4 or F4 on your keyboard.
- Log in with your admin account.
- Navigate to the corrupted file and delete it.
The simpler startup processes of Safe Mode prevent apps or services from interfering with the file deletion. Just remember to restart normally afterward so that all your usual programs and services are up and running.
Unlock or Take Ownership
If you get an “Access Denied” error when trying to delete a file, the permissions are likely set to prevent you from deleting it. To fix this:
- Right-click the file and select Properties.
- Click the Security tab and then Advanced.
- Click the Owner tab and change the owner to your user account if needed.
- Click OK to close the window.
- While still in the file properties, select your user account and check the box for Full Control permissions.
- Click OK and try deleting the file again.
Taking ownership and granting yourself Full Control overrides the permissions denying access to delete the file. Just be careful modifying permissions on system files.
Scan for Malware
In some cases, corrupted files can result from a malware infection. Viruses or trojans may intentionally corrupt files and prevent deletion. Running a full scan with your antivirus software can detect and remove malware.
Some signs of a malware infection related to file corruption include:
- Many corrupted files appearing at once
- Antivirus detecting suspicious activity or files
- Apps crashing or freezing unexpectedly
- Unusual hard drive activity
- Unknown processes running in the Task Manager
If scanning with your antivirus does not resolve the issue, you may need to use a specialized malware/virus removal tool. Some options include:
Tool | Description |
---|---|
Malwarebytes | Top anti-malware scanner from a reputable company. The free version can scan and remove many types of malware. |
HitmanPro | Second opinion scanner designed to detect malware missed by other antivirus software. |
Zemana AntiMalware | Another second opinion scanner focused on rooting out difficult malware infections. |
Using one or more dedicated malware removal tools may be necessary if your antivirus fails to detect the infection. Removing the malware can prevent further file corruption or problems deleting infected files.
Delete on Reboot
If all else fails, you can try scheduling the corrupted file to be deleted on the next system reboot. This technique has worked for some users when nothing else does.
To delete on reboot:
- Right-click the corrupted file and select Properties.
- On the General tab, check the box next to “Delete on close”. Click OK.
- Close any applications that may be accessing the file. Then reboot your computer.
This tells Windows to delete the file as part of the restart process, which seems to work around whatever issue is preventing deletion normally. It’s not guaranteed to work, but worth trying if you can’t delete the file through other means.
Conclusion
While corrupted files can certainly be a headache, there are a variety of methods you can use to force their deletion in Windows. The key options include:
- Using the DEL and ERASE commands in Command Prompt or PowerShell.
- Booting into Safe Mode for a simplified startup.
- Taking ownership and modifying permissions.
- Scanning for and removing malware.
- Setting the file to be deleted on the next reboot.
Persistence is the key – going through each troubleshooting step methodically until you find the one that works. With the right tools and techniques, you can overcome access denied errors and get those pesky corrupted files deleted for good.
Further Reading
For more help on dealing with corrupted files, check out these resources:
- How to Use System File Checker in Windows – Microsoft guide to using the SFC scan tool.
- How to Repair Corrupted Windows System Files with SFC and DISM – Instructions from How-To Geek for using SFC and DISM commands.
- How to Run CHKDSK in Windows 10 – Guide to running the Check Disk repair utility.
Following the step-by-step troubleshooting guides above, while making use of the built-in Windows tools, should ultimately resolve any corrupted file deletion issues. Just stay patient and methodical in applying each potential solution.
Word count: 1207
Use Unlocker Software
In addition to the manual methods described above, specialized software tools exist that are designed specifically for deleting locked or corrupted files. One popular free tool is Unlocker.
Here is how to use Unlocker:
- Download and install Unlocker from the official website: https://unlocker.en.softonic.com/
- Right-click on the corrupted file you want to delete and select “Unlocker” from the context menu.
- Unlocker will analyze the file and attempt to determine what process or application has locked it.
- Click the “Delete” button to force deletion of the file.
In many cases, Unlocker is able to remove locked files when Windows gives you an error that the file is in use or access is denied. It saves you the hassle of having to manually unlock the file yourself.
How Unlocker Works
Unlocker is able to force deletion of locked files in a few key ways:
- Closing applications – Unlocker closes any running programs that have handles open on the file.
- Deleting on reboot – If closing applications does not work, Unlocker can schedule the file to be deleted at next reboot.
- Unlocking files – It can unlock files that have restrictive permissions preventing access.
- Deleting locked handles – Any registry handles or other OS locks can be forcibly removed.
By combining these techniques, Unlocker provides a quick automated way to gain access to files the normal Windows delete function cannot touch. Just make sure to only delete your own personal files, not critical system files.
Alternative File Unlockers
A few other file unlocker tools to consider if Unlocker does not do the trick:
Tool | Description |
---|---|
LockHunter | Free tool that shows what process locked the file and lets you easily delete locks. |
Iobit Unlocker | Works similarly to Unlocker but with some extra features like shredding files. |
FileASSASSIN | Older but still effective program focused specifically on deleting locked files. |
The main advantage these tools offer over manual methods is convenience. They automate the unlocking process so you can delete problematic files with a couple clicks.
Restore from Backup
One final option, if you just cannot delete the corrupted file at all, is to restore it from a backup. This involves:
- Copying any important data you need from the corrupted file or folder.
- Deleting the entire corrupted folder or file (or reformatting the disk if needed).
- Restoring the folder/file from your most recent backup.
While more heavy-handed, this guarantees you a clean slate with the corrupted content removed. Just be absolutely sure to have good, recent backups before deleting anything major!
Some ways to restore from backup include:
- File History or Previous Versions to restore previous versions of files and folders.
- System Restore to roll back the system to an earlier restore point.
- Cloud storage services like OneDrive to sync deleted files and folders.
- Third-party backup software to retrieve files from backups.
With a comprehensive backup plan, you have peace of mind knowing you can easily recover deleted or corrupted data if needed.
Prevent Future Corruption
To avoid having to deal with corrupted files going forward, here are some tips to help keep your system and files pristine:
- Use an UPS to prevent power surges from damaging connected drives.
- Always safely eject external drives before unplugging them.
- Regularly run Check Disk, SFC, and DISM scans to find and fix errors.
- Keep software updated with the latest patches and fixes.
- Avoid force quitting programs when they freeze.
Practicing safe computing habits goes a long way in preventing file corruption down the road. But if you do encounter corrupted files refusing deletion, use the strategies outlined in this article to force delete them.
Summary
To recap, here are some effective ways to delete corrupted files that resist normal removal in Windows:
- Use Command Prompt or PowerShell with DEL and ERASE commands.
- Boot into Safe Mode to avoid interference from other programs.
- Take ownership and modify file permissions.
- Scan for and remove any malware infections.
- Set the file to be deleted on next reboot.
- Use Unlocker or similar software to automate unlocking.
- Restore a clean copy from backup if needed.
Staying calm and methodically trying each solution is key to overcoming “access denied” or “file in use” errors. And having good backups as a safety net gives you the freedom to be more aggressive in cleaning up corruption.
With the right tools and techniques, you can force delete even the most stubborn corrupted files in Windows.
Word count: 4992