How to Delete Locked Files in Windows

Who I am
Matthew Wilhelm Kapell
@matthewwilhelmkapell
Author and references

Deleting files from your computer is usually a simple task, but some files can make this process more difficult than expected. Namely, some files may be locked and cannot be deleted because they are in use by a program, the Windows operating system, or for other reasons.

Locked folders cannot be opened, deleted, or moved in Windows until the password is used, and it may be impossible to find a password for files that you haven't locked. Although the "Delete" option will be visible, you will not be able to click on it and delete the file.



However, if you want to delete a locked file, you can try several approaches. In this article, we will explain the different methods available.

Safe mode

The most common approach is to restart your Windows PC in Safe Mode to delete a locked file. Here are the steps to do so:

  1. Open the Start menu by clicking on the Windows logo in the lower left corner.
  2. Select the "Windows Settings" gear symbol.
  3. Choose the Windows "Update and Security" option.
  4. Select the “Recovery” option. It will be in the left corner of the screen.
  5. Click the "Restart Now" button. This will restart your computer and bring you to the "Advanced Options" panel.
  6. Select "Troubleshoot".
  7. Navigate to the "Advanced" tab in the center of the screen.
  8. Select the "Startup Settings" options on the right side.
  9. Click the "Restart" button at the bottom of the window.
  10. Choose "Enable Safe Mode" from the drop-down menu.
  11. In the "Startup Settings" window, press "4" or "F4".

Allow Windows to complete its restart. Enter your password if required. Once the operating system has finished booting:



  1. Locate your file by opening the Start menu, then "File Explorer."
  2. Click on the previously locked file, then on the "Home" tab, then on "Delete" in the next toolbar. Alternatively, you can select the file by clicking on it and pressing the "Delete" key.
  3. Remove everything from the trash. Your file should be deleted from the system.

You can exit safe mode by restarting your computer after deleting your file.

Process explorer

You can also use Windows Process Explorer to delete a locked file. For some users, this approach may be more convenient. Follow these steps:

  1. Access the locked file. Simply double-click the file to move it to the “Runtime” section of PC Task Manager.
  2. Navigate to the Process Explorer webpage.
  3. Click the "Download Process Explorer" button. This will allow the Process Explorer ZIP archive to be downloaded to your PC.
  4. Double-click it in the location folder to open the "ProcessExplorer.zip" folder.
  5. Select the "Extract to" option at the top of the screen. A toolbar will appear.
  6. Choose "Extract All". When you click on it, a new window appears.
  7. Click "Extract".

From there, the Process Explorer program will be installed and the installation folder will open. Now it's time to use Process Explorer:

  1. Launch “Process Explorer”. If your PC has a 64-bit processor, double-click the "procexp64" item in the folder. If your system has a 32-bit processor, double-click "procexp" instead.
  2. When prompted, select "OK". This will launch the main Process Explorer window.
  3. Select "File" and choose "Show details of all processes".
  4. When prompted, select "Yes" to minimize Process Explorer.
  5. Select "Search".
  6. Choose “Search for handle or DLL…” A search bar will appear.
  7. Fill in the text box with the name of the locked file, then click the "Search" button to the right of the text field.
  8. Choose the locked file. In Process Explorer, find the highlighted filename near the bottom of the screen.
  9. Right-click on the file name and choose "Properties".
  10. Click the "Close Handle" button. By doing so, the file is unlocked and you can delete it.

Finally, it's time to delete the locked file:



  1. Locate your file. Open the Start menu, then File Explorer and locate the formerly locked file.
  2. Delete the file. Click on the previously locked file, then on the "Home" tab and "Delete" in the toolbar. Or, you can select the file by clicking on it and then pressing the “Delete” key.
  3. Remove everything from the trash.

Command Prompt

Another way to delete a locked file is to use the command prompt. Follow these steps to do so:


  1. Launch the Command Prompt by typing "Command Prompt" in the Windows search box.
  2. Select "Run as administrator".
  3. Type “del /f file name” in the pop-up window and press “Enter”. Please keep in mind that you need to change the file name to your own file name.

Note that a file deleted using the command prompt cannot be recovered if you change your mind.

Run Chkdsk

First, open the Command Prompt window and run it as administrator. Steps to do so can be found above. To continue, follow these steps:

  1. Type “chkdsk c: /f /r /x” in the command line window and press Enter. You can change the drive letter if it is not C.
  2. Find your file.
  3. Delete the file.
  4. Empty the recycling bin.

Change the file extension

Sometimes this is the easiest way to erase a file that won't be deleted when you press the "Delete" key. If you have a file named filename.mp3, click on it in file explorer, press F2 and change the extension (.mp3) to something else, like .txt.

However, you must first enable file extensions, as Windows hides extensions for recognized file types by default. Go to the "View" tab and check the "File name extensions" box to allow extensions on Windows.

Have control over your files

Even though these methods are not as simple as simply deleting a file, sometimes these methods are the only way. Remember that Windows versions are different and the steps may vary, but the main idea remains the same. The most significant difference is that File Explorer is Windows Explorer in older versions.

Some third-party apps and programs can help you delete a locked file. However, be careful with them. Please do your research before downloading. Some may contain malware and damage your files.

Have you ever had trouble deleting a file? How did you solve it? Let us know in the comment section below!

Audio Video How to Delete Locked Files in Windows
add a comment of How to Delete Locked Files in Windows
Comment sent successfully! We will review it in the next few hours.