“The process cannot access the file because it is being used by another process” is Windows system error 32, named ERROR_SHARING_VIOLATION. It means another program has the file open in a way that does not allow what you are trying to do, such as delete, rename, move or overwrite it. The fix is to find that program and close the file, or close the program. Windows rarely tells you which program it is. LockGhost from Automata Labs does: paste, drag or right-click a path and it lists every process holding it by friendly name, using the Windows Restart Manager API, so you can close the right one.
See which process is holding your file, by name, and release it safely.
Get it from Microsoft
What does error 32 mean?
Microsoft’s list of system error codes defines it:
| Code | Name | Message |
|---|---|---|
| 32 (0x20) | ERROR_SHARING_VIOLATION | The process cannot access the file because it is being used by another process. |
| 33 (0x21) | ERROR_LOCK_VIOLATION | The process cannot access the file because another process has locked a portion of the file. |
You may see the same error in other forms:
- 0x80070020 is error 32 wrapped as an HRESULT. Windows APIs that return HRESULTs map system error codes with HRESULT_FROM_WIN32, and 32 becomes 0x80070020. It shows up in Windows Update, installers and some backup tools.
- “The action can’t be completed because the file is open in another program” is File Explorer’s friendlier wording of the same situation.
- An IOException in PowerShell, .NET apps and build tools, with the same “being used by another process” message.
Error 33 is a close cousin. It means another process has locked part of the file, often a database or a document that supports shared editing.
Why does Windows block the file?
When a program opens a file, it tells Windows what it will allow other programs to do with that file at the same time. Microsoft’s CreateFile documentation explains the share mode: if a program opens a file with a share mode of zero, “the file or device cannot be shared and cannot be opened again until the handle to the file or device is closed.” If you then request access that conflicts with the existing open handle, “CreateFile would fail and the GetLastError function would return ERROR_SHARING_VIOLATION.”
In plain terms: the first program got there first and said “nobody else touches this.” Until it closes the file, Windows enforces that.
Common culprits:
- The app you used last. Word, Excel, a PDF reader or a video player still has the file open.
- Explorer itself, for example while generating a thumbnail or showing a preview pane.
- Sync clients such as OneDrive, uploading or scanning the file.
- Antivirus, scanning a new or changed file.
- Search indexing, reading the file’s contents.
- Developer tools, such as a dev server, file watcher, terminal or IDE holding a folder open.
- A process that crashed or hung without closing its handles.
How do I fix “being used by another process”?
Work through these in order, from least to most disruptive:
- Close the file in the app you used. Save and close the document, not just the window.
- Wait a moment and retry. Antivirus scans and sync uploads often finish within seconds.
- Turn off Explorer’s preview pane if the file is selected in a folder with preview on.
- Pause sync for the folder, then retry.
- Find the process holding it. Use LockGhost, or Resource Monitor’s Associated Handles search (run
resmon, open the CPU tab and search for the file name). - Close that program normally. Only end the process if it is not responding and you know what it is.
- Sign out or restart if nothing else works. That closes every handle.
How do I find which process is using the file?
Windows has the information, it just does not show it in the error. The Restart Manager is the part of Windows that installers use to find out which applications and services are using files they need to update. Microsoft’s documentation explains that the primary reason updates require a restart is “that some of the files that are being updated are currently being used by a running application or service.”
LockGhost puts that same mechanism behind a simple window. According to its product page and Microsoft Store listing:
- Restart Manager based. Locks are resolved through the official Windows Restart Manager API and translated into readable process names.
- One field, three ways in. Paste a path, drag a file or folder in, or right-click it in Explorer.
- Friendly names instead of process IDs, with color-coded severity so system processes stand out.
- Guarded End Process. One-click End Process ships with safeguards to reduce the chance of ending a critical system process by mistake.
- Local lock history stored on your PC.
- Offline, with no cloud account and no telemetry.
Paste the path from the error message and see who is holding it.
Get it from Microsoft
LockGhost vs the built-in options
| Error message | Resource Monitor | LockGhost | |
|---|---|---|---|
| Names the process | Sometimes, usually not | Yes | Yes, friendly names |
| Works from Explorer right-click | No | No | Yes |
| Shows severity of the process | No | No | Color-coded |
| Ending a process | No | Yes, no guardrails | Guarded End Process |
| History of past locks | No | No | Local history |
| Built in | Yes | Yes | One-time purchase |
For a wider comparison, including Microsoft’s own PowerToys tool, see PowerToys File Locksmith vs LockGhost and our guide to the Restart Manager way to find a file lock.
Where does error 32 show up most often?
| Where you see it | Usual cause | Where to look |
|---|---|---|
| Deleting a file in Explorer | The app you opened it in | Cannot delete a file in use |
| Saving an Excel workbook | Another Excel instance, a preview or a sync client | Excel file in use, cannot save |
| Git checkout, pull or clean | An editor, terminal or dev server | Git cannot delete a file used by another process |
| OneDrive folders | OneDrive syncing the file | OneDrive file in use |
| Build tools and scripts | A file watcher or a previous build still running | Your terminal sessions and background tasks |
| Windows Update and installers, as 0x80070020 | A running app or service | Close apps, retry, then restart |
How do I avoid error 32 in my own scripts?
If you write scripts or code that open files, a few habits prevent most sharing violations:
- Close files as soon as you are done. In PowerShell and .NET, dispose of streams, for example with a
usingblock. - Open with a compatible share mode when other programs need to read the file at the same time.
- Retry with a short delay when you hit error 32 on a file that antivirus or sync might be touching.
- Do not keep a terminal sitting inside a folder you are about to delete. The shell’s working directory holds the folder open.
- Stop watchers before cleanup. Dev servers and file watchers often hold handles on folders.
Frequently asked questions
What is error code 32 in Windows?
It is ERROR_SHARING_VIOLATION: “The process cannot access the file because it is being used by another process.” Another program has the file open in a way that blocks your action.
What is error 0x80070020?
It is error 32 in HRESULT form. You will see it in Windows Update, installers and other tools that report HRESULT codes.
Is error 32 the same as access denied?
No. Access denied is error 5, which is about permissions. Error 32 is about another program using the file right now.
Will restarting fix “being used by another process”?
Usually, because a restart closes every open handle. Finding and closing the right program is faster and does not lose your other work.
Is it safe to end the process holding a file?
Closing the program normally is safest. Ending a process can lose unsaved work, and ending a system process can make Windows unstable. LockGhost’s severity colors and End Process safeguards help you avoid the risky ones.
Try LockGhost
Get LockGhost from the Microsoft Store. It is a one-time purchase, and the Store listing shows the current price.
Turn “used by another process” into a name you can act on.
Get it from Microsoft
Microsoft, Windows, Excel, Word, OneDrive and PowerToys are trademarks of the Microsoft group of companies. Git is a trademark of Software Freedom Conservancy. LockGhost is not affiliated with or endorsed by them.
Last updated 19 October 2026. Published by Automata Labs, a software company in Canada.