Sometimes, when deleting a file on Windows, you get a pop-up window with the "File in Use" error message. This indicates that the file that you are trying to eradicate is being used by a program or process on your Windows device that has locked it, preventing it from being deleted, renamed, or moved. It could be a visible app like a media player, photo viewing app, MS Word, or Excel, or it could be a hidden process that is active in the background, like Windows Update.
Thankfully, if you don't want to wait on it or stress about how to locate it, there are several methods to delete a file in use by another program in Windows 10 and 11 systems. Nearly all of these methods can be applied through built-in tools and settings, except for one which requires a third-party app.
How to recover deleted files in Windows 11
Accidentally deleted a file from your PC? Here's how you can recover files you've deleted on Windows 11 and 10.
How to delete a file being used by another program
Here are some practical ways to dodge the pop-up and delete files that are in use by a program on your Windows PC.
Identify the file or program and end it
The most straightforward way to tackle the "File in Use" error is to identify the file or the program that is using the file and end it. Perhaps you accidentally opened multiple instances of the file and forgot to close all of them. So if you get the error message while deleting a document, image, or video, simply look for the opened instances of the file in question and close any and all of them. After closing all the file windows, try deleting the file again; this time, you shouldn't get an error message.
If the error occurs when a file is being used by an active program, try to identify that program from the error message and exit it. If you can't identify the program, exit all the active applications on your system one by one and check if that works.
If even exiting the responsible program doesn't work, it's possible that one or more processes of the program are active in the background. To identify and end those, follow the steps below.
- Right-click on the taskbar and select Task Manager from the list.
- Under the Processes tab, look for the program that's using the file you are trying to delete.
- Right-click on it, and select End Task.
- Repeat the same steps to end all the programs which may be running relevant processes, one by one.
If you try to delete the file again, it should be removed from your system without any error message now.
Restart your PC
If you are still experiencing the error, try restarting your system. This often gives your PC a fresh start by ending all of the unnecessary processes. If a hidden process is holding the file, making it impossible to delete, restarting the PC might end that process and release the file for deletion. You can restart your PC the usual way: Start button, Power Icon, then the Restart option.
Use Command Prompt to delete a file
If you are unable to delete a file in the traditional way, i.e., by using File Explorer, try deleting that file using Command Prompt. Sometimes, due to some glitch in File Explorer, the delete action on Windows might not work as expected and cause a "File in Use" error.
You should know that even this method won't work if the file is actually being used by any other program. Try this method only if you need to check if File Explorer is responsible for the issue.
Follow the steps below to delete a file through Command Prompt.
- Right-click on Start and select Terminal (Admin) from the Power User Menu. If you are using Windows 10, select Command Prompt (Admin).
- Next, copy the path to the folder where your file is located. Open that folder, click at the extreme right of its address bar, use Ctrl + A to select the full path, and use Ctrl + C to copy it.
- Now, press the Ctrl + Alt + Delete buttons and select Task Manager from the list.
- Look for the Windows Explorer process (aka File Explorer), right-click on it, and select End Task.
- Now, switch back to the Command Prompt window using the Alt + tab shortcut.
- Type the cd command, and then paste the path of the folder you copied earlier using Ctrl + V. Example: cd E:\sample.
- Here, use the del command to delete the file. Type del "FileName.extension" and hit enter (using your actual file name with its extension for FileName.extension).
If you don't get an error, it means the file is deleted, and File Explorer was causing the "File in Use" error. However, if you are still getting the same error, proceed to the next method to counter it. Before that, though, restart your File Explorer. To do this, press Windows + R to open the Run dialog box and use the explorer.exe command.
Boot in Safe Mode to delete a file in use
If you are still getting the "File in Use" error when deleting a file, boot your system in Safe Mode and try to delete it again. Safe Mode starts Windows with only essential processes, services, and drivers. So, if a third-party app or process is holding the file and preventing it from getting deleted, Safe Mode will free it and let you delete it.
In case you haven't had to do this before or lately, here are the steps to boot Windows in Safe Mode:
- Press Windows + R to launch the Run dialog box.
- Type msconfig and hit the enter key to launch the System Configuration window.
- Under it, switch to the Boot section and check the box next to the Safe Boot option.
- Select how you would like to boot into Safe Mode. You can choose the "Alternate Shell" to boot into Safe Mode with Command Prompt.
- Finally, click Apply and OK to save the changes and then restart your system.
Your PC will be boot in Safe Mode. Attempt to delete the file now and check if the error persists.
Use a third-party app
If all the above methods fail or if it's hard to follow the steps to perform any of the above methods, the last resort is to use a third-party application to delete the stubborn file being used by another program. The best program for that function is LockHunter. It's freeware that's specifically designed to unlock and force-delete a file that is locked or being used by an app or process.
Here are the steps to download and use the LockHunter app:
- Download the latest version of the LockHunter app installer from its official website.
- Run the installer and follow the on-screen steps to install the program.
- After the program is installed successfully, right-click on the file that's refusing to delete and select the "What's locking this file?" option from the context menu. If you are using Windows 11, right-click on the file and select Show more options to get this option.
- This action will display all the processes that have locked this file. Now, click the Delete It button to delete this file.
- On the warning prompt, click Yes to continue.
- The file will be unlocked and deleted.
Get rid of stubborn files and free up storage
Facing a "File in Use" error while deleting a file can be frustrating, especially if it's caused by a background process that you cannot identify. However, with the methods listed in this guide, you can easily eradicate these stubborn files and free up storage on your Windows PC.
