By default, the Windows operating system prevents users from deleting running files. While this is often a useful feature, if your computer has unwanted malware you may find yourself in the situation of not being able to delete a malicious file because Windows sees it running or restricts access to it. There are 3 solutions for this problem. Follow this guide to get to know them all.
Steps
Method 1 of 3: Delete the File by Terminating the "explorer.exe" Process
Step 1. Finish the "explorer.exe" process
This process is associated with Windows Explorer, and prevents users from deleting files in use. Finishing the process will allow you to delete the file with the command prompt. Open the Task Manager by holding down the "Control", "Alt" and "Delete" keys. Click on the "Processes" tab and select "explorer.exe". Click on the "End Process" button.
Step 2. Navigate to the location of the file with the command prompt
To open the command prompt, click on "Start" and then on "Run". Type "cmd" in the window and click "Run". In the command prompt window, you can use the "cd" (change directory) command to navigate to the location of the file. For example, you could type: "cd C: / Documents / My Documents / filename." You should of course use the path where the locked file is located.
Step 3. Delete the locked file from the command prompt
To do this, use the "del" command. Type "del filename", replacing filename with the name of the locked file.
Step 4. Restart the explorer process
To do this, open the Task Manager again and click on "File" and then on "New Task". Type "explorer.exe" in the window and click "Ok". You can also restart your computer to reset the explorer process.
Method 2 of 3: Delete the File Using the Windows Recovery Console
Step 1. Boot your computer from the installation disc
Turn off the computer, put the Windows installation disc in the optical drive and turn on the computer. Windows will boot from the CD and not the hard drive.
Step 2. Enter Recovery Console Mode
This is the Windows troubleshooter application. When the "Welcome to Setup" screen appears, press the "R" key to enter the application.
Step 3. Delete the locked file
When the console is ready, navigate to the location of the locked file as you would using the command prompt (using the instructions in the previous section). After deleting the file with the "del" command, type "exit" to exit the Recovery Console and restart your computer.
Method 3 of 3: Delete the File Using Unlocker
Step 1. Download and install the Unlocker application
It is a free program that allows you to easily delete locked files. Download it from the internet, and double click on the file to start the installation.
Step 2. Open Unlocker
Start browsing folders to navigate to the file location on Windows Explorer. Right click on the file and select the new "unlocker" option from the context menu. The program will open displaying the information of the locked file.
Step 3. Delete the locked file
In the Unlocker window, click the "Unlock All" button. This will remove the file access restrictions. Close the Unlocker window and delete the file normally with Windows Explorer.