0X00000020

Fix ERROR_SHARING_VIOLATION (0X00000020) – File in Use

Windows Errors Beginner 👁 1 views 📅 May 28, 2026

That file's locked by another program. Here's how to unlock it fast – start with the quickest fix, then move to deeper options if needed.

You hit the ERROR_SHARING_VIOLATION (0X00000020).

I know this error is infuriating—you're trying to save, delete, or move a file, and Windows throws up that wall. Usually it's a background process like antivirus, a sync tool (Dropbox, OneDrive), or even Windows Search indexing that's grabbed the file and won't let go. The fix is straightforward: figure out who's holding it, then release it. Let's start with the easy stuff.

Quick Fix – 30 seconds: Close the obvious culprits

First, shut down any programs that might be using that file. This is the fastest check.

  1. Save your work in all open apps.
  2. Close programs like Word, Excel, Photoshop, or any editor tied to that file type.
  3. If the file is in a folder like OneDrive or Dropbox, right-click the sync icon in your system tray and pause syncing for 30 minutes.
  4. Try the file operation again.

If that works, you're done. If not, something sneakier has it locked.

Moderate Fix – 5 minutes: Use the built-in tool to find the lock

Windows has a tool called Resource Monitor that can show you exactly which process has your file open.

  1. Press Ctrl + Shift + Esc to open Task Manager.
  2. Click the Performance tab, then at the bottom click Open Resource Monitor.
  3. In Resource Monitor, go to the CPU tab.
  4. Expand the Associated Handles section.
  5. In the search box, type the filename (or part of it).
  6. You'll see a list of processes with a handle on that file—note the process name, like explorer.exe or svchost.exe.
  7. Right-click that process and choose End Process (only if it's safe—don't kill system processes like svchost.exe unless you're sure).

I've seen this trip up folks who forget that Windows Search indexing locks files. If the process is SearchIndexer.exe, you can safely end it temporarily—it'll restart on its own.

After ending the process, retry your file operation. If it works, great. If not, move to the advanced fix.

Advanced Fix – 15+ minutes: Use a dedicated tool to unlock the file

When Resource Monitor can't find the lock (rare, but happens with deep system services), you need a more powerful tool. I recommend Handle from Microsoft Sysinternals—it's free, tiny, and precise. Also, Process Explorer (also from Sysinternals) gives you a GUI option.

Option A: Handle (command line)

  1. Download Handle from Microsoft's site.
  2. Extract the files to a folder, say C:\Tools\Handle.
  3. Open Command Prompt as Administrator (right-click Start, choose Windows Terminal (Admin) or Command Prompt (Admin)).
  4. Type: C:\Tools\Handle\handle.exe -a -u "C:\path\to\your\file.ext" (replace the path with your actual file).
  5. It'll list the process and its PID. Look for entries like pid: 1234.
  6. Close the handle by typing: C:\Tools\Handle\handle.exe -c <handle-value> -p <pid> -y (use the handle value from the list).

I once had a file locked by a phantom Windows Update process that didn't show in Resource Monitor. Handle found it in 3 seconds.

Option B: Process Explorer (GUI)

  1. Download Process Explorer from Microsoft's site.
  2. Run procexp.exe as Administrator.
  3. Press Ctrl + F to open the Find Handle or DLL dialog.
  4. Type the filename and click Search.
  5. Double-click the result—it'll jump to the process holding the lock.
  6. Right-click that process and choose Close Handle or Kill Process (kill only if necessary).

Process Explorer is my go-to for visual hunting. It's saved me countless times with stubborn Excel files left open in background instances of Excel.

What if you can't kill the process?

Sometimes the process is a critical system service (like svchost.exe hosting a service). In that case:

  • Restart the service: Open Services.msc, find the service related to the process (e.g., Windows Search), and restart it.
  • Or just reboot the machine. It's blunt, but it works.

One more real-world scenario

I've seen this error most often with Microsoft Office files left in a crashed Word or Excel instance. Even after closing the app, a background process (WINWORD.EXE or EXCEL.EXE) can linger. Open Task Manager, look for those processes, and end them. That's usually the fix for 80% of cases.

Summary table of fixes

FixTimeWhen to use
Close apps & pause sync30 secondsFirst try—works for obvious programs
Resource Monitor5 minutesWhen quick fix fails
Handle or Process Explorer15+ minutesStubborn locks not found by Resource Monitor
Reboot5+ minutesLast resort—always works

That's it. Start with the quick fix, and work your way down. You'll have that file free in no time.

Was this solution helpful?