Why the file is locked — and by whom
The lock is called a sharing violation: the program that opened the file told Windows to keep other programs from deleting or renaming it, and Windows enforces that faithfully. It is a safety feature — deleting a file a program is actively writing would corrupt it. The frustration comes from holders that never show a window of their own.
- Explorer's Preview and Details panes — viewing a video or PDF keeps the file open; close the pane (View → Show → off) or restart Explorer
- Thumbnail and icon builders — pictures and videos can stay locked a few seconds after you view them
- The Windows search indexer — briefly locks documents while adding them to the index
- OneDrive, backup and antivirus software — actively syncing or scanning files; pause them to test
- Microsoft Office lock files — a ~$ prefix twin of your document means Office still has it open, or crashed with it open
Finding the process with Resource Monitor
Press Win+R, type resmon and press Enter — the Resource Monitor ships with every Windows 10 and 11. Switch to the CPU tab, expand Associated Handles, and in the search box there type part of the locked file's name — for the file Report.docx, typing report is enough. A moment later every process holding a matching handle appears; right-click it → End Process, confirm, then switch back to Explorer and delete the file.
Read what you are about to end before you end it. For your own apps — a media player, an editor, a stuck installer — ending the process is safe and only loses unsaved work. If the holder is System, svchost.exe or another Windows service, do not kill it; reboot instead and delete the file immediately after logging in, before anything else opens it. Sysinternals Process Explorer (Ctrl+F) offers the same find-handle idea with more detail.
When the lock survives everything
The reliable fallback is timing: restart the PC, log in, and delete the file before launching anything else — after a clean boot the usual invisible holders have not started yet. For files that stubbornly relock, boot into Safe Mode (Settings → System → Recovery → Advanced startup → Restart now → Troubleshoot → Advanced options → Startup settings → Safe mode) and delete from there, where third-party software does not run.
Two cautions keep the cure from being worse than the problem. Files under C:\Windows\WinSxS and the component store are locked by Windows itself for a reason — never force-delete them; use Disk Cleanup or DISM instead. And Office's ~$ lock files delete themselves once you close all Office apps, so they rarely need heroics. If a whole folder refuses to go, check that OneDrive sync is paused and that no backup job is mid-run.
Questions and Answers
How do I find out which program is using a file?
Open Resource Monitor (Win+R → resmon), go to the CPU tab, expand Associated Handles and search for part of the file name. Every process holding the file is listed and can be ended from the right-click menu.
Is it safe to end the process that locks my file?
For your own applications, yes — you only lose unsaved work in that app. If the holder is System or a Windows service like svchost.exe, close things gracefully or reboot instead of killing it.
What are the ~$ files I cannot delete?
They are Microsoft Office lock files — ownership markers created next to open documents. Close all Office apps (or reboot) and they disappear or delete without a fight.
Know what is included before you buy.
The one-time 30-minute trial covers core tools. PRO-labelled features stay locked until a paid license is activated.
Read next
Write to us: [email protected]