Sometimes, when deleting a file on a Windows computer, you may encounter an error that reads: “The action cannot be performed because the file is open in a program.” When this error appears, it means that you are dealing with a locked file and cannot delete it, no matter what you do. Your computer will keep giving the same error on the screen, telling you that the file is being used by some program.
Dealing with such locked file errors is actually quite simple, although at first it might seem like it isn’t. You’ve probably guessed by now that the reason you can’t delete the file is because an application on your computer is using it. How about closing this program and then deleting the file?
There are several similar workarounds to help you successfully delete a locked file on your computer.
Close the program that is using the locked file
The most obvious solution is to close the program that is using the file you want to delete. If it is a Word file open in MS Word, close the program and you can delete the locked file.
Likewise, whichever program has the file open, simply close the program and it will release the file ready to be deleted.
Kill the program process with Task Manager
Sometimes it happens that a program using a locked file does not respond to your actions and just gets stuck at some point. In this case, you can kill the program process so that it can be forcibly closed on your computer.
– / pre>
After closing the program, your file should be free of any processes and you can delete it from your computer.
- Right-click the taskbar at the bottom of the screen. and select the task manager option. This will launch the utility on your computer.
- If you do not see all of your processes immediately after opening it, click on the “More” option to expand the view.
- Click on the Processes tab at the top if you are not already there. You should see all the processes that are currently running on your computer. You want to find the process that you think your file is using. Then click on a process to select it and then click on the End Task button in the lower right corner.
- This will complete the process for the selected program and you can now delete the file on your computer.
Turn off the preview pane in File Explorer
The preview pane in File Explorer allows you to preview the locked file. It might be that your file is being previewed and is preventing you from deleting it on your Windows computer.
Disabling the panel should fix the problem for you.
- Launch File Explorer on your PC. Opening any folder on the screen should do it for you.
- When it opens, find and click the View tab at the top. The option you want is found here.
- Look at the first panel labeled Panels and you will find the Preview Panel option. Click on it and it will be disabled if it was enabled before.
You should be able to delete the file if it was occupied by the preview pane.
Switch folder operation in File Explorer
Perhaps the explorer process is using your locked file and you cannot delete it. There is actually an option that helps you create separate processes for each folder you open on your PC, and it’s worth switching it to see if that helps solve your problem.
- Open File Explorer and go to the View tab. Click the down arrow below Options and select Change Folder and Search Options.
- Click the View tab on the next screen.
- You will find several options that can be turned on and off for the explorer utility. Find the option labeled Run folder windows in a separate process and enable it. If this setting is already enabled, it should be disabled.
- Click Apply and then OK to save your changes.
Play and close a locked file
The locked file may not have been closed properly the last time you accessed it in your programs.
- To be sure, just open the file in your program and then close it properly.
- When the file is completely closed, right-click it and select Delete. The file will be deleted without causing any errors on the screen.
Restart your Windows PC
When you restart your computer, all processes are closed, including the one using your file.
- Click the start menu, select the power icon and select Restart.
- Try to delete the file when you restart your computer.
Use the command prompt to delete the file
You can try using a command line utility to delete a file that cannot be deleted in the GUI.
- Press Windows + R keys at the same time, type cmd and press Enter.
- Type the following command and press Enter. Remember to replace PATH with the path to the file you want to delete.
It will delete the file immediately without error.
Use a third-party application to open and delete the file
For some reason, if none of the above methods work for you, you can use a third-party app to unlock the file and then delete it.
Unlocker is a free app that helps you unlock files so you can delete them.
- Download, install and run the application on your computer.
- ask you to select your file. Select the file you cannot delete and click “OK”.
- Select Delete from the first drop-down menu and click OK.
It will do whatever it takes to unlock your file and then delete it from your computer without any prompts.