What the "File in Use" Error Means
The "File in Use" error (or its English equivalent "The process cannot access the file because it is being used by another process", error code 32) is a Windows system message that appears when you try to perform an operation on a file (delete, rename, move, change), but the operating system detects that the file currently has an open handle by another active process.
Symptoms:
- When attempting to delete:
The process cannot access the file because it is being used by another process. - When attempting to rename/move: similar message.
- In Command Prompt or PowerShell:
The process cannot access the file because it is being used by another process.
Causes
The error occurs because Windows uses an "open handle" model. While a program has an open handle to a file (for reading, writing, or execution), the system does not allow other processes to modify the file's metadata to avoid data corruption. Specific causes:
- The file is open in a program. The most common case. You closed the Word window, but the
WINWORD.EXEprocess remained in the background (e.g., in the system tray). Or a log file is open in Notepad++. - The file is used by a background service or process. System services (e.g.,
SearchIndexer.exefor indexing, backup services, antivirus) may scan or process the file. - Antivirus software. Real-time scanning implementations often lock the file briefly for inspection.
- The file is an executable or library (DLL) loaded into memory. If you try to delete an
.exeor.dllthat is currently being executed or used by another process, the system will prohibit it. - Orphan process. A program crashed, but its process remained in memory and holds the handle.
- Network access. If the file is on a network resource, it may be locked by a remote user or process.
Solutions
We recommend following the methods in order of increasing complexity and radicality.
Method 1: Close the program manually (simplest)
Often the solution is obvious.
- Recall which program you last worked with this file in (Word, Excel, Photoshop, IDE, media player).
- Close this program completely. Not just the window, but the entire process. Check in Task Manager (
Ctrl+Shift+Esc) on the "Processes" or "Details" tab to see if the program's process is still there. If so — select it and click "End task". - Retry the file operation.
Method 2: Use Task Manager to search
If you don't know which program holds the file.
- Open Task Manager (
Ctrl+Shift+Esc). - Go to the "Details" tab (in Windows 10/11).
- Sort the "Name" column alphabetically.
- Review the process list, looking for those that might be related to your file (by program name or file type). Common culprits:
SearchIndexer.exe,AdobeIPCBroker.exe,OneDrive.exe,Dropbox.exe,explorer.exe. - Caution: Ending system processes (
explorer.exe,svchost.exe) may cause system instability. Only end processes whose purpose you understand. - Select the suspected process and click "End task".
- Try working with the file again.
Method 3: Identify the exact process via PowerShell (precise method)
This method allows you to find the process that specifically holds a handle on your file.
- Open PowerShell as Administrator (Win+X → Windows PowerShell (Admin)).
- Run the command, replacing
C:\путь\к\файлу.txtwith the actual path to your file:
What the command does: It iterates through all processes, attempting to get a list of loaded modules (DLLs/EXEs). If a module's name matches your file's path, the process is output.$file = "C:\путь\к\файлу.txt" Get-Process | Where-Object { try { $_.Modules.FileName -like "*$file*" } catch { $false } } - In the output, you'll see the process name (e.g.,
notepad). Note its PID (process ID) or name. - End this process either via Task Manager (by name or PID) or in PowerShell:
TheStop-Process -Name "process_name" -Force # Or Stop-Process -Id 1234 -Force # where 1234 is the PID-Forceflag ensures termination.
Method 4: Use Process Explorer (most reliable)
Process Explorer from Sysinternals (Microsoft) is an advanced version of Task Manager that shows all handles open by each process.
- Download Process Explorer from the official Microsoft website.
- Run
procexp.exeas Administrator (right-click → "Run as administrator"). - Press
Ctrl+F(or menuFind→Find Handle or DLL...). - In the window that opens, enter your file's name (or part of it) and click "Search".
- At the bottom of the window, a list of processes with an open handle to this file will appear.
- Double-click a found result. This will highlight the corresponding process in the main Process Explorer window.
- Right-click the highlighted process and select
Close Handle. Confirm the action. - Close Process Explorer and try the file operation again.
Method 5: System reboot (radical but guaranteed)
If previous methods didn't help or you cannot identify the process (e.g., it's a system process that can't be terminated), rebooting is the simplest way to reset all handles.
- Save all data in other open programs.
- Reboot the computer (
Start→Restart). - After the system fully loads, avoid opening programs that might have worked with this file, and immediately try to delete/move it.
Prevention
To minimize the risk of the "file in use" error:
- Close programs properly. Not just with the close button, but via the "File" → "Exit" menu, especially for heavy applications (IDE, graphic editors).
- Don't leave files open in background programs. For example, if you edited a log file in Notepad++, close it too.
- Configure your antivirus. Add the folder with frequently modified files (e.g., your project folder) to the real-time scanning exclusions. Do this with caution and only if you are sure about the file safety.
- Use "Safe Mode" for critical operations. If you need to clean a folder with system/program files, boot into Safe Mode (hold
Shiftwhen clicking "Restart" in the Start menu → "Troubleshoot" → "Advanced options" → "Startup Settings" → "Restart" → select "Safe Mode"). In this mode, minimal drivers and services load. - For developers: Ensure your code (in Python, C#, Java, etc.) properly closes file streams (
f.close(),using(),try-with-resources). A handle leak in your program is a common cause of locking.