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.
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:
- Open the Start menu by clicking on the Windows logo in the lower left corner.
- Select the "Windows Settings" gear symbol.
- Choose the Windows "Update and Security" option.
- Select the “Recovery” option. It will be in the left corner of the screen.
- Click the "Restart Now" button. This will restart your computer and bring you to the "Advanced Options" panel.
- Select "Troubleshoot".
- Navigate to the "Advanced" tab in the center of the screen.
- Select the "Startup Settings" options on the right side.
- Click the "Restart" button at the bottom of the window.
- Choose "Enable Safe Mode" from the drop-down menu.
- 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:
- Locate your file by opening the Start menu, then "File Explorer."
- 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.
- 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.
You can also use Windows Process Explorer to delete a locked file. For some users, this approach may be more convenient. Follow these steps:
- Access the locked file. Simply double-click the file to move it to the “Runtime” section of PC Task Manager.
- Navigate to the Process Explorer webpage.
- Click the "Download Process Explorer" button. This will allow the Process Explorer ZIP archive to be downloaded to your PC.
- Double-click it in the location folder to open the "ProcessExplorer.zip" folder.
- Select the "Extract to" option at the top of the screen. A toolbar will appear.
- Choose "Extract All". When you click on it, a new window appears.
- 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:
- 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.
- When prompted, select "OK". This will launch the main Process Explorer window.
- Select "File" and choose "Show details of all processes".
- When prompted, select "Yes" to minimize Process Explorer.
- Select "Search".
- Choose “Search for handle or DLL…” A search bar will appear.
- Fill in the text box with the name of the locked file, then click the "Search" button to the right of the text field.
- Choose the locked file. In Process Explorer, find the highlighted filename near the bottom of the screen.
- Right-click on the file name and choose "Properties".
- 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:
- Locate your file. Open the Start menu, then File Explorer and locate the formerly locked file.
- 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.
- Remove everything from the trash.
Another way to delete a locked file is to use the command prompt. Follow these steps to do so:
- Launch the Command Prompt by typing "Command Prompt" in the Windows search box.
- Select "Run as administrator".
- 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.
First, open the Command Prompt window and run it as administrator. Steps to do so can be found above. To continue, follow these steps:
- 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.
- Find your file.
- Delete the file.
- 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!