Fixed: Error 0x80070020 When a File Is in Use by Another Program
Error 0x80070020 means the file you are copying, moving, or deleting is locked open by another process. Find the process with Resource Monitor or handle.exe, close it, and the action completes immediately.
-
1. Read the Dialog for the Exact File Name
The error names the file or folder it could not touch. Write it down, including the extension — `lock` messages on `notes.txt` and `notes.tmp` are different problems. If the dialog offers a Details expander, open it: sometimes Windows…
-
2. Search Resource Monitor for the Handle
Press Start, type `resmon`, and open Resource Monitor. On the CPU tab, click into the `Associated Handles` search box and type the file name. The list underneath shows every process with a live handle on it, with its PID. That is your…
-
3. Use handle.exe for a Faster Answer
Microsoft's Sysinternals `handle.exe` does the same search from a terminal, in seconds: `handle.exe "notes.txt"` lists the process and PID holding the file. On a file you touch often, keep handle.exe on the desktop — one command replaces…
-
4. Check Whether Explorer Itself Is the Holder
If the process in the results is `explorer.exe`, the preview pane or a thumbnail scan has the file open. This is the most common holder and the most harmless: the file is not in use by anything you opened, just by Windows drawing its own…
-
5. Look for Sync and Backup Tools in the List
OneDrive, Google Drive, Dropbox, and backup agents all hold brief handles while they upload a file you just saved. If the holder is one of these, the lock releases by itself within seconds. Pause the sync client if you need the file right…
-
6. Close the Holding Process Normally
If Resource Monitor names an app you recognize — Word holding a document, Excel holding a spreadsheet — switch to that app and close the file inside it, or close the app itself. A clean close releases the handle and flushes any unsaved…
-
7. End the Process in Task Manager
When the holder will not close on its own, press `Ctrl+Shift+Esc`, find it under Processes, right-click, and choose `End task`. Use this on apps you have already tried to close normally. If the handle was the only thing it held, the file…
-
8. Restart Windows Explorer
For an Explorer-owned handle, right-click `Windows Explorer` in Task Manager and choose Restart. The screen flashes and every folder window closes — no files are lost, but the preview and thumbnail handles are dropped. Retry your copy…
-
9. Sign Out to Release Every Handle at Once
If the file is held by something you cannot identify, sign out of Windows instead of shutting down apps one by one. Signing out closes every process in your session, releasing every handle. Sign back in and retry before anything reopens…
-
10. Retry the Original Action
With the handle released, run the copy, move, or delete again. If the error is gone, you are done. If it comes back immediately with the same file, something re-opens it the moment it is freed — that is a background tool, and Method 3 is…
-
11. Pause the Sync Client Before Big Moves
OneDrive and similar tools re-grab any file that changes under their watched folders. Before reorganizing a synced folder, click the cloud icon in the tray and pause syncing for an hour. Do the moves with the client asleep, then resume…
-
12. Exclude the Folder From Antivirus Scanning
Real-time scanners hold files open while checking them, and a busy folder — a build output, a photo import — hits 0x80070020 constantly. Add that folder to your antivirus exclusion list so it is not scanned on every write. Keep the…
-
13. Turn Off the Preview Pane
Explorer's preview pane opens every file you click, and on large documents its handle outlives your click. Press `Alt+V` in File Explorer and untick Preview pane, or uncheck it under `View > Preview pane`. The 0x80070020 errors that came…
-
14. Disable Thumbnail Generation for Problem Folders
Thumbnails are built by opening the file, so a folder of raw photos or videos locks constantly. Open `Folder Options > View` and tick `Always show icons, never thumbnails`. On media folders you copy often, this removes the most frequent…
-
15. Run the Copy With Robocopy Retry Settings
For big moves where one locked file should not kill the job, use robocopy: `robocopy "C:\From" "D:\To" /E /R:2 /W:5`. The `/R:2 /W:5` retries a locked file twice with a five-second wait — long enough for a sync tool to release it — and…