Can't Delete File Open in Windows 10? Quick Fix Guide
In this article
Yes—you can delete a file that Windows 10 says is in use by first releasing the lock, then removing the file with normal Explorer actions or a command‑line command.
What You'll Need
- An administrator‑level account (or permission to run as administrator).
- Access to Task Manager, Resource Monitor, or Command Prompt.
- Patience for a quick restart if all else fails.
Step‑By‑Step
- Identify the program that is using the file.
- Right‑click the file in File Explorer and choose Properties → Details to see the file type. Knowing the type often points to the responsible program (e.g., a .docx is likely open in Word).
- Close the program normally.
- If the program is visible, click its Close button or use Alt+F4. Some background services keep files open even after the UI is closed; proceed to the next step if the file remains locked.
- Use Task Manager to end the process that still holds the handle.
- Press Ctrl+Shift+Esc to open Task Manager.
- Click More details if you see the compact view.
- Locate the suspected process (e.g.,
WINWORD.EXEfor Word,explorer.exefor Explorer previews) and click End task. Confirm any warning. - If you are unsure which process is responsible, skip to step 4 for a systematic search.
- Find the exact locking process with Resource Monitor.
- Open the Start menu, type
resmon, and press Enter. - Go to the CPU tab, then expand the Associated Handles section.
- In the search box, type part of the file name (including extension). The list will show the process name and the handle.
- Right‑click the offending process and choose End Process. If the process is a critical system service, do not end it; instead, consider a safe‑mode approach later.
- Open the Start menu, type
- Delete the file.
- Return to File Explorer, navigate to the file, and press Delete or right‑click → Delete.
- If the file still refuses, open an elevated Command Prompt:
- Press Win+X and choose Windows Terminal (Admin) or Command Prompt (Admin).
- Type
del /f /q "C:\Path\To\YourFile.ext"and press Enter. The/fflag forces deletion, and/qsuppresses confirmation.
- If the file still cannot be removed, reboot into Safe Mode and delete it there.
- Open Settings → Update & Security → Recovery → Advanced startup → Restart now.
- After the PC restarts, choose Troubleshoot → Advanced options → Startup Settings → Restart.Press 4 to boot into Safe Mode.
- Once in Safe Mode, navigate to the file and delete it normally.
Common Mistakes
Many users try to delete the file while the offending program is still running in the background, which inevitably fails. Another frequent error is ending the wrong process—closing explorer.exe will close the desktop itself, but the lock may persist in a hidden explorer instance. Using del without the /f flag can also leave the file untouched if Windows reports it as read‑only or in use.
Tips
- Keep a shortcut to
resmon.exeon your desktop if you often encounter locked files; it saves a few clicks. - If the file belongs to a Microsoft Office document, use the built‑in Recover Unsaved Documents feature before forcing a delete, to avoid losing unsaved work.
- For developers, the Sysinternals tool
Handle.execan show the exact PID and allow you to close the handle directly from a command line. - When dealing with system files (e.g., DLLs in
System32), consider whether you truly need to delete them; replacing or repairing the component via Windows Update is safer.
Troubleshooting
If the steps above do not free the file, follow this escalation path:
- Restart the computer. A simple reboot often releases transient locks held by background services.
- Check for pending Windows updates. An update that is installing can lock files in the
Windowsfolder. Complete the update, then try again. - Run a virus scan. Malware sometimes keeps files open to hide its activity. Use Windows Defender or your preferred security suite to perform a full scan.
- Use the built‑in "Unlocker" functionality. While Windows does not ship a dedicated unlocker, the Open Files – Security console (run
taskmgr→ Performance → Open Files – Security) can show and release locks on some systems. - Boot from a Windows PE USB drive. If the file resides on the system partition and still refuses deletion, start the PC from a bootable Windows PE environment, navigate to the drive, and delete the file. This method guarantees no Windows processes are running on that volume.
- Seek help from the software vendor. Certain applications (e.g., Adobe Photoshop) keep temporary caches open even after closing. Vendor documentation may describe a specific “clean‑up” utility.
Frequently Asked Questions
Why does Windows say "The process cannot access the file because it is being used by another process"?
That message means a running process has an open handle to the file. Windows prevents deletion to avoid data loss or crashes.
Can I delete a locked system file safely?
Generally no. System files are protected for stability. If a system file is truly corrupted, use the built‑in System File Checker (sfc /scannow) or DISM to repair it instead of manual deletion.
Is it safe to end explorer.exe to free a lock?
Ending explorer.exe will close the desktop and taskbar, but the lock may persist in a child process. After ending it, you must restart Explorer by running explorer.exe from Task Manager’s File → Run new task dialog.
What if the file is on a network share?
Network locks are often held by another computer. Use the net file command on the server (e.g., net file ) or ask the remote user to close the file.
Does Safe Mode guarantee I can delete any file?
Safe Mode loads only essential drivers and services, so most locks disappear. However, files used by core Windows services (e.g., the pagefile) remain locked even in Safe Mode.
Will using third‑party unlock tools damage my system?
Reputable tools from Microsoft’s Sysinternals suite are safe, but any utility that forcibly closes handles can cause data loss if the program was actively writing to the file. Always back up important data before using such tools.