HOW TO: Delete an Undeletable or Locked File

A woman's finger hovering over the delete keyHave you ever happened upon a situation where you needed to delete a file, but Windows just would not allow you to do it? These things happen to me all the time, especially when I’m at a client’s business trying to get their machine clean of malware. Have you ever tried deleting a locked file using common windows commands? If so, then you’ll know that this just isn’t possible.

The main reason behind this is that the explorer.exe process locks files that are in use, in effect preventing you from deleting them. Usually, these files should not be touched, but sometimes situations come up when you really need to erase some troublesome ones.

Fortunately, there are a few easy solutions to delete those files.

Solution #1: Kill explorer.exe

  1. Open a command prompt
  2. Navigate to the location where the locked file is
  3. Press CTRL-ALT-DEL, click on “task manager”, select the Processes tab
  4. Kill the explorer.exe process via the “End Process” button
  5. Go back to the command prompt and delete the file (del filename.ext)
  6. Bring up the task manager windows again
  7. Select file -> new task
  8. Type explorer.exe in the “create new task” field
  9. Press OK.

Solution #2: Use The Windows Recovery Console

Just stick your Windows CD in your CD tray, boot the computer with it, and at the “Welcome to Setup” screen, press “R“. Once the recovery console has started, navigate to the location of your locked file, and delete it. Since WRC does not really start the system, the files will not be in use, and you will be able to delete them. Oh, and for all you Linux geeks out there, we know doing this via a linux live CD / USB key is also possible.

Solution #3: Use Unlocker (Download)

Unlocker is a very useful freeware that will allow you to unlock any files that are currently in use by Windows. You’ll know if this is happening if you are getting any of these messages when trying to delete a file:

  • Cannot delete file: Access is denied
  • There has been a sharing violation
  • The source or destination file may be in use
  • The file is in use by another program or user
  • Make sure the disk is not full or write-protected and that the file is not currently in use
  • Unlocker will make things right again for you.

You’ll notice that right after installing the software, a new option named “unlocker” will appear when right clicking any files or folders in Windows Explorer. To unlock a locked file, just right click it, select unlocker, and the unlocker software will start.

unlocker3

Then, click “unlock all” and close the software. Now that your file is unlocked, just delete it in Windows Explorer, as you always do. This is much simpler than solution #1 or #2, isn’t it?

I hope these three solutions will help you get rid of those hard to delete files!

Tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *