How do you get rid of a file that you can’t delete?

We’ve all been there before – you have a file on your computer that you want to delete, but for some reason it just won’t budge. No matter how many times you try to send it to the Recycle Bin, the file remains firmly in place, almost mocking your futile attempts to get rid of it.

There are a number of reasons why a file may refuse deletion. It could be in use by a running program, marked as read-only, corrupted in some way, or stubbornly sticking around due to permissions issues. Whatever the cause, being unable to delete a file can be extremely frustrating.

Fortunately, with the right approach and tools, even the most stubborn of files can eventually be banished from your hard drive for good. Here are some effective methods for getting rid of those pesky undeletable files.

Check and Close Associated Programs

One of the most common reasons a file can’t be deleted is because it is currently open or in use by a program on your computer. If a file is locked by an application, Windows will not allow it to be deleted.

Before attempting to delete stubborn files, you should close all programs that could potentially be using them. This includes any apps that may run automatically in the background. Exit your email, office suites, media players, browsers, and any specialty software related to the file type in question.

Once all associated programs have been closed, try deleting the file again and see if it works. Simply closing open applications will allow many seemingly undeletable files to be removed successfully.

Unlock the File

If closing background programs doesn’t do the trick, the file you want to delete may be locked by the operating system itself. On Windows computers, right clicking a file and selecting properties will display information about it. If there is a checkmark by “Read-only” under the General tab, it means the file attributes are configured as read-only.

Read-only status prevents files from being altered or deleted. To unlock a read-only file:

  1. Right click on the file and select Properties
  2. Uncheck the box next to Read-only
  3. Click Apply then OK

With read-only unchecked, you should now be able to delete the file as usual.

Change File Permissions

If a file seems undeletable even when unlocked, the next thing to check is your user account permissions. On business networks or computers with multiple user profiles, access to files and folders is typically restricted based on user privileges.

To delete a file your user profile does not have full control permissions for:

  1. Right click the file and select Properties
  2. Go to the Security tab and click Advanced
  3. Change the owner to your user account
  4. Ensure your user account has Full Control checked
  5. Apply the permission changes

Taking ownership and granting yourself Full Control enables you to bypass permission restrictions so you can delete the file.

Boot Into Safe Mode

Booting into Windows Safe Mode loads a minimal, pared back version of the operating system. This can allow you to delete files you couldn’t remove when fully booted into Windows.

To boot into Safe Mode:

  1. Open the Start menu and click the Power button
  2. Hold down the Shift key while clicking Restart
  3. On the Choose an Option screen select Troubleshoot > Advanced Options > Startup Settings > Restart
  4. After your PC restarts, press 5 on the Startup Settings screen to boot into Safe Mode

Now try deleting the file. Some files that persist due to program locks or SYSTEM permissions may be removable from Safe Mode.

Delete on Boot

Another option is to schedule the stubborn file for deletion the next time you restart your computer. This works because pending file operations are executed as Windows loads before other programs start.

To set a file to delete on reboot:

  1. Press Windows + R to open the Run box
  2. Type: cmd
  3. Click OK to open Command Prompt
  4. Type: del /f /q “C:\Path\To\File” /s /r
  5. Replace the file path with your target file
  6. Restart your computer

The /f /q /s /r parameters force deletion of the specified file on restart. This method can remove files that resist other deletion attempts.

Use Unlocker

For advanced cases where built-in methods fail, try using a specialized unlocking utility. Unlocker is a free tool designed specifically for deleting stubborn files.

To use Unlocker:

  1. Install and open Unlocker
  2. Right click on the locked file and select Unlocker from the context menu
  3. Click Unlock or Delete

Unlocker will attempt to free the file from any locks or handles that are preventing deletion. It provides a force delete option that usually succeeds in removing the most stubborn of files.

Delete from Command Prompt

Command Prompt provides access to powerful built-in tools that can forcibly delete stubborn files when other methods fail.

To delete an undeletable file from Command Prompt:

  1. Open Command Prompt as administrator
  2. Type takeown /f “C:\Path\to\File” and hit Enter
  3. Type icacls “C:\Path\to\File” /grant Administrators:F and hit Enter
  4. Type del /f /a “C:\Path\to\File” and hit Enter

The takeown command takes ownership of the file. Icacls grants Full Control permissions to your Admin account. Del /f /a forcibly deletes the file.

Delete System File from PE Environment

If the undeletable file is a Windows system file that loads at boot, you may need to delete it from a Preinstallation Environment (PE). This gives full access before the operating system starts.

To delete stubborn system files using a PE:

  1. Create a Windows 10 bootable USB or DVD using Media Creation Tool
  2. Boot your PC from the installation media
  3. Select Repair your Computer at the first screen
  4. Go to Troubleshoot > Command Prompt
  5. At the X:\Sources> prompt type: diskpart
  6. Type list volume and note your Windows drive letter
  7. Type exit to close DiskPart
  8. Type del D:\Path\to\File using your Windows drive letter
  9. Close Command Prompt and restart normally

From the PE environment, locked system files can be deleted before Windows boots up.

Reset Security Settings

Corrupted security settings can also cause files to become undeletable. Resetting your user or system security policies may help eliminate file lock issues.

To reset security policies:

  1. Open Command Prompt as admin
  2. Run netplwiz and uncheck require users to enter a username and password
  3. Sign out or restart your PC and sign back in
  4. Run sfc /scannow to scan and restore system files
  5. Run DISM /Online /Cleanup-Image /ScanHealth to scan and repair the Windows image

Resetting user and system security settings can help resolve corrupted permissions preventing file deletion.

Delete from Linux Live CD

Booting from a Linux live CD provides a simple way to delete Windows files from an external operating system. Since the Windows filesystem drivers are not loaded, file locks and permissions are ignored.

To use a Linux Live CD to delete Windows files:

  1. Download an Ubuntu ISO and create a bootable DVD or USB
  2. Boot your PC from the Ubuntu media
  3. Open the File Manager and navigate to your Windows drive
  4. Right click on files and click Delete to remove them
  5. Restart your PC and boot back into Windows

Deleting files through an external Linux environment is an effective way to bypass Windows file lock restrictions.

Repair Drive Errors

If a system file becomes damaged, it can remain locked and prevent deletion. Repairing drive errors may restore proper file operations.

To fix drive errors that could cause file lockouts:

  1. Open Command Prompt as admin
  2. Run chkdsk C: /f to scan your primary drive
  3. Use the parameter /r instead of /f if bad sectors are reported to fully repair errors
  4. Restart your PC and retry deleting the file

Chkdsk scans and restores filesystem errors that can sometimes cause stubborn file issues.

Delete from Elevated RE Command Prompt

The Windows Recovery Environment (RE) provides access to advanced Windows troubleshooting tools. An Admin Command Prompt within RE has full system privileges for deleting locked files.

To access the RE Admin Command Prompt:

  1. Open the Start menu and search for “Recovery”
  2. Click Recovery -> Reboot Now under Advanced Startup
  3. After your system reboots select Troubleshoot > Advanced Options
  4. Go to Command Prompt and run commands to delete your file

The RE environment provides powerful file deletion capabilities that can overcome stubborn locks.

Disable Antivirus Temporarily

Some antivirus programs will quarantine or lock infected files to prevent spreading malware. You may need to temporarily disable your antivirus to remove quarantined files.

To disable antivirus protection:

  1. Open your antivirus software settings
  2. Find the option to disable virus and threat protection
  3. Save your changes and restart your computer
  4. Try to delete quarantined files before re-enabling protection

Turning off antivirus shields allows removal of infected files in quarantine.


While undeletable files can certainly be a headache, there are many effective methods available for regaining control of your hard drive. With the right tools and techniques, even the most stubborn files that defy deletion can eventually be banished.

The key is to remain calm and methodical in your approach. Carefully work through each solution until you find the one that works for your specific situation. Trying simpler options first, like closing programs or unlocking files, can resolve many issues before moving onto more complex solutions.

Leveraging the power of Command Prompt, recovery environments, and external OS deletion provides the ultimate file removal capabilities when needed. Don’t let difficult files win – persist and keep trying different tactics until you can successfully delete anything.