Sometimes when you delete a file on Windows, you may see a pop-up window with the error message “File is in use”. This indicates that the file you are trying to delete is being used by a program or process on your Windows device that has locked it and prevents it from being deleted, renamed or moved. It could be a visible app like a media player, photo viewer app, MS Word or Excel, or it could be a hidden process running in the background like Windows Update.
If you don't want to wait for it or worry about how to find the file, fortunately there are several methods to delete a file used by another program in Windows 10 and 11 systems. Almost all of these methods can be applied via built-in tools and settings, except for one method that requires a third-party app.
How to delete a file that is being used by another program
Here are some handy ways to bypass the pop-up and delete files used by a program on your Windows PC.
Identify the file or program and terminate it
The easiest way to fix the “File is in use” error is to identify the file or program that is using the file and exit it. Perhaps you accidentally opened multiple instances of the file and forgot to close them all. So, if you get the error message when deleting a document, picture, or video, just look for the open instances of the file in question and close them all. After closing all file windows, try deleting the file again. This time, you shouldn't get an error message.
If the error occurs while a file is being used by an active program, try to identify and exit that program from the error message. If you cannot identify the program, exit all active applications on your system one by one and see if that works.
If even closing the program in question doesn't work, it's possible that one or more of the program's processes are running in the background. To identify and close them, follow these steps.
- Right-click on the Taskbar and select Task Manager from the list.
- Under the Processes On the tab, locate the program that uses the file you want to delete.
- Right-click on it and select End task.
- Repeat the same steps to terminate, one by one, all programs that may be running relevant processes.
If you try deleting the file again, it should now be removed from your system without an error message.
Restart your PC
If the error still occurs, try restarting your system. This often restarts your PC by ending all unnecessary processes. If a hidden process is holding onto the file and therefore it cannot be deleted, restarting the PC may end that process and release the file for deletion. You can restart your PC in the usual way: Start button, Power icon and then the “Restart” option.
Use the command prompt to delete a file
If you are unable to delete a file using the traditional method, i.e. using File Explorer, try deleting the file using Command Prompt. Sometimes, due to a bug in File Explorer, the delete action on Windows may not work as expected and cause a “File is in use” error.
You should know that even this method will not work if the file is actually being used by another program. Try this method only if you need to check if File Explorer is responsible for the problem.
To delete a file using the command prompt, follow the steps below.
- Right-click on start and select Terminal (Administrator) from the Power User Menu. If you are using Windows 10, select Command Prompt (Admin).
- Then copy the path to the folder where your file is located. Open this folder, click on the far right in the address bar and use Ctrl + A to select the full path and use Ctrl + C to copy it.
- Now press the Ctrl + Alt + Del and select Task Manager from the list.
- Search for Windows Explorer Process (also known as File Explorer), right-click on it and select End task.
- Now switch back to the command prompt window with the Alt + Tab Abbreviation.
- Enter the CD and then paste the path of the folder you previously copied with Ctrl + V. Example: cd E:\Example.
- Use the del Command to delete the file. Enter del “filename.extension” and press Enter (for filename.extension, type your actual file name with the extension).
If no error message appears, it means that the file was deleted and File Explorer caused the “File is in use” error. However, if you are still encountering the same error, proceed to the next method to fix it. But before that, restart your File Explorer. To do so, press Windows + R to open the Run dialog box and use the explorer.exe Command.
Boot into Safe Mode to delete a file in use
If you still get the “File is in use” error when deleting a file, boot your system into Safe Mode and try deleting the file again. Safe Mode boots Windows with only essential processes, services, and drivers running. So if a third-party app or process is holding onto the file and preventing it from being deleted, Safe Mode will release it and allow you to delete it.
If you haven't had to do this before or only recently, here are the steps to start Windows in Safe Mode:
- Press Windows + R to launch the Run dialog box.
- type msconfig and press Enter to enter the System configuration Window.
- Switch to Boots and check the box next to the Safe start Option.
- Choose how you want to boot into Safe Mode. You can select the option “Alternative 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 boot into Safe Mode. Now try deleting the file and check if the error persists.
Use a third-party app
If all the above methods fail or it is difficult 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 that is being used by another program. The best program for this function is LockHunter. It is freeware 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 LockHunter App installer from official website.
- Run the installer and follow the on-screen instructions to install the program.
- After the program has been successfully installed, right-click on the file that cannot be deleted and select the option “What is locking this file?” from the context menu. If you are using Windows 11, right-click the file and select Show more options to get this option.
- This action will display all processes that have locked this file. Now click on the Delete button to delete this file.
- In the warning message, click Yes to continue.
- The file will be unlocked and deleted.
Get rid of stubborn files and free up storage space
It can be frustrating to encounter the “File is in use” error when deleting a file, especially when it is caused by a background process that you cannot identify. However, with the methods listed in this guide, you can easily delete these stubborn files and free up space on your Windows PC.