File in Use Error: Causes & Fixes
In this article
The "process cannot access the file because it is being used by another process" error appears when Windows or an application tries to open, modify, or delete a file that is currently locked by a running program. This lock is a normal safety feature, but it becomes a problem when the locking process does not release the file properly, and this guide explains why it happens and how to fix it.
What Does This Error Actually Mean?
Every time a program opens a file, Windows places a lock on it to prevent other programs from making conflicting changes. The lock is tied to a specific process—the running program that requested the file. When you or another program tries to access the same file, Windows checks whether that lock exists. If it does, you get the error message, often with the file path and the word "being used."
This is not a sign of a corrupt file or a virus. It is a routine protection mechanism that has either not been released due to a bug, or is still legitimately held because the program is actively using the file. For example, if you have a document open in a word processor and try to delete it from File Explorer, you will see this error because the word processor still has the file open.
Why Does This Happen So Often?
The most common reason is simply that a program has the file open and you are trying to access it from another program. But there are several other scenarios that cause the error even when no program appears to be using the file:
- Background processes: Antivirus scanners, cloud sync tools (like OneDrive or Dropbox), and indexing services may briefly open files to scan or index them. If you try to access the file at that exact moment, you get the error.
- Hung or crashed programs: If a program crashes, Windows sometimes fails to release the file lock immediately. The process may still be running in the background, even though the window is gone.
- File Explorer preview pane: The preview pane in File Explorer can lock a file while it generates a thumbnail or preview. This is a frequent cause for image and video files.
- Malware or third-party shell extensions: Some programs add context menu items or background services that hold files open longer than necessary.
How to Find Which Process Is Locking the File
Before you can fix the problem, you need to identify the process that holds the lock. Windows does not show this information in the error message, but you can find it with built-in tools or free utilities.
- Use Resource Monitor: Press Windows + R, type
resmon, and press Enter. Go to the CPU tab, expand the Associated Handles section at the bottom, and type the file name in the search box. It will list the process that has the file open. - Use Process Explorer (from Microsoft Sysinternals): Download and run Process Explorer (free from Microsoft). Press Ctrl + F to open the Find Handle or DLL window, type the file name, and it will show the process.
- Use the command line: Open Command Prompt as administrator and run
openfiles /queryto see a list of open files, but note that this requires the "Maintain Objects List" global flag to be enabled, which is off by default.
How to Fix the Error (Step-by-Step)
Once you know which process is holding the file, you can choose the right fix. Here are the most effective methods, in order of safety:
- Close the program normally: If the process is a visible application (like Word or Excel), save your work and close it. Then try to access the file again.
- End the process in Task Manager: If the program is hung or invisible, open Task Manager (Ctrl + Shift + Esc), find the process, right-click it, and select End Task. Be careful: unsaved changes will be lost.
- Restart Windows Explorer: If the lock is from the preview pane or thumbnail generation, restart Explorer. In Task Manager, right-click Windows Explorer and choose Restart.
- Disable the preview pane: In File Explorer, go to the View tab and turn off the Preview pane and Details pane to avoid future locks.
- Use a third-party tool to force unlock: Programs like LockHunter or Unlocker can release the lock by closing the handle. They are free but not officially supported by Microsoft. Use them with caution.
- Restart your computer: This clears all file locks and is the simplest solution if you cannot identify the process.
Common Mistakes and Misconceptions
Many users assume the error means the file is corrupted or that they lack permission. That is rarely the case. The error is about the lock, not about file integrity or user rights. Another misconception is that you need to take ownership of the file or change its permissions—that will not help because the lock is independent of permissions.
A common mistake is to try to delete a file that is open in a program you think is closed. For example, if you close a document in Microsoft Word but the Word process remains running in the background (which happens if you close the window but not the application), the file may still be locked. Always check Task Manager for lingering processes.
Another frequent error is trying to move a file while a cloud sync client is uploading it. If you see the error with files in a OneDrive or Dropbox folder, wait a few seconds for the sync to finish, or pause the sync temporarily.
When the Error Happens on System Files or Folders
If the error occurs on a Windows system file (like in C:\Windows) or a folder that is constantly in use (like Program Files), the cause is often a Windows service or the operating system itself. In that case, do not force-unlock the file. Instead, try these steps:
- Run a disk check: Open Command Prompt as administrator and run
chkdsk /f. This may fix file system issues that cause locks to persist. - Boot into Safe Mode: In Safe Mode, only essential drivers and services run, so many locks are gone. Try to perform the operation there.
- Use the Windows Update troubleshooter: If the error occurs during a Windows update, run the built-in troubleshooter from Settings > Update & Security > Troubleshoot.
How to Prevent the Error in the Future
While you cannot completely avoid file locks, you can reduce the frequency of this error:
- Close programs before moving or deleting files.
- Disable the preview pane in File Explorer if you frequently work with media files.
- Configure your antivirus to exclude folders you work with regularly, if you trust the contents.
- Keep your programs updated, as buggy versions may fail to release locks.
- If you use a cloud sync service, pause it when you need to do bulk file operations.
Frequently Asked Questions
Why does this error appear even when no program is open?
Background processes like antivirus scans, search indexers, and cloud sync clients can open files without showing a visible window. Also, a program may have crashed but its process is still running in the background. Use Resource Monitor to see which process has the file open.
Can I just delete the file anyway?
No. If the file is locked, Windows will not allow you to delete it. Trying to force deletion with third-party tools can corrupt the file or cause the program using it to crash. Always release the lock first.
Is it safe to force-unlock a file with a third-party tool?
It can be safe if you know what you are doing, but it can also cause data loss or program instability. Only use such tools as a last resort, and only on files that are not critical to your operating system.
Does this error mean my hard drive is failing?
No. The error is about file locks, not disk health. If you also see read/write errors or hear strange noises, then you might have a disk problem, but this specific message is not a sign of hardware failure.
Why does this happen with files on a network drive?
Network drives often have additional locks from the server or other users. If someone else has the file open on their computer, you may get this error. Also, network latency can cause locks to appear longer than necessary.