Jump Links
When you can't open, edit, or delete a file in Windows File Explorer, it's either still open in a program running in the background or something didn't close properly. Luckily, you can force delete, close, or edit a file using a few simple tricks.
1 Close the Program You Opened the File With
Let's start with the obvious. Did you just open the file and not close it? If the file is closed, but the program is still running, close the application, then try again.
You should also, check the system tray to ensure it wasn't just minimized there.
2 End the Application via the Task Manager
Task Manager can help manually end the process or application that holds your file hostage. This is one of the most promising methods to fix the "file is open in another program" error, as you might not always realize it didn't close properly.
Press Ctrl + Shift + ESC on your keyboard to open the Task Manager. Alternatively, you can press Ctrl + Alt + Del to reach the menu or right-click the Taskbar and select Task Manager. If you're on Windows 11, the Taskbar right-click won't work.
If you see the compact Task Manager version, click More details in the bottom left and make sure you're in the Processes tab.
Browse for the application that you used to open the "file in use." For example, if you were viewing a document, look for Microsoft Word.
Once you find the process, select it and click End task in the bottom right. This will close all instances of the program.
3 Change File Explorer Process Settings
By default, File Explorer launches all its windows in a single process (explorer.exe). However, it could be that your settings force File Explorer to launch separate processes, which could cause a conflict between different processes.
Press the Windows key + E to open File Explorer. In Windows 10, go to View > Options > Change folder and search options.
In Windows 11, click the three-dot "See more" icon next to View, then select Options.
In the Folder Options window, switch to the View tab and find the Launch folder windows in a separate process option. Make sure it's not checked. Click Apply to save any changes.
If the option was unchecked in the first place, you should check to see if this solves your issue.
4 Disable the File Explorer Preview Pane
Previews in File Explorer can also cause conflicts, like the "file is open in another program" error.
In Windows 10, press the Windows key + E, switch to the View tab, and press Alt + P to close the preview pane.
In Windows 11, open File Explorer (Windows key + E), then go to View > Show, and, if you see a checkmark next to Preview pane, click it to close the preview.
The screenshot below shows an open preview pane on the right.
After closing the preview pane, try the operation again and see whether the "file in use" error has disappeared.
5 Force Delete the File in Use via the Command Prompt
You can bypass File Explorer and force delete the file using Command Prompt.
First, we need to track down the file path directory in File Explorer. Press the Windows key + E to open File Explorer, locate the affected file, and copy the file path from the adress bar at the top of the window.
Now right-click the Windows Start button and select Command Prompt (Admin) or Windows Terminal (admin). To navigate to the file directory of your file in use, enter cd [directory path you copied] and hit Enter.
Before we can force delete the file in use, though, we have to temporarily kill the File Explorer process. This will cause your Taskbar, wallpaper, and open folders to disappear. But don't worry, you can easily restart File Explorer and get everything back after.
- To close File Explorer, press Ctrl + Shift + ESC to open Task Manager.
- Find Windows Explorer in the list and right-click the process. Select End task.
- Return to the Command Prompt window where you entered the command before.
- Enter the command below to delete the file, replacing everything between the quotes with the actual file name:
del "file name"
Now, to restart the File Manager all you need to do is open the Task Manager (Ctrl + Shift + ESC). Then click File > Run new task, enter explorer.exe, and click OK. This should restore your desktop to its usual appearance.
6 Unlock the File in Use With a Tool
If trying to delete the file manually didn't work or if you aren't comfortable using Command Prompt, you can always use Microsoft's Process Explorer
It is a more powerful version of the Task Manager that can show you which process took your file hostage.
Open Process Explorer's Search window by clicking on Find > Find Handle or DLL (or press Ctrl + Shift + F), enter the file name, and wait for the list of processes accessing your file.
You can't close the process from the Search window, but you can use Process Explorer or Windows Task Manager to close the offending application. There are also alternatives, such as Unlocker and LockHunter, which can help you identify bothersome processes.
7 Boot Into Safe Mode
Sometimes, the file you're trying to delete may automatically be loaded by another application. Apps like Unlocker should still work if that's the case. However, if malware is involved or if you don't want to deal with third-party tools, then booting into Safe Mode is your next best bet.
In Windows 10 or 11, press the Win key on your keyboard and click the Power icon. Hold the Shift key and select the Restart option. Your PC will boot to the Windows Recovery Environment (WinRE) page.
From the next screen, select Troubleshoot > Advanced Options > Startup Settings > Restart. When your computer reboots, you'll see the Startup Settings screen. Choose Safe Mode and wait for Windows to boot up.
Once you're in Safe Mode, navigate to the file in question and try to access or delete it.
Now, the next time Windows tells you a file is in use, you know how to free it up or force your PC to delete it. If you aren't comfortable with third-party tools, you can always use Command Prompt, or boot into Safe Mode to help clear out any issues with the file in question.