Steps only.

How to Unlock a File That Says It Is Open in Another Program

Windows 11; Windows 10 differences noted where they exist · Last checked · Suggest an edit

Windows refuses to move, rename, or delete a file because something still has it open. Work through these from least to most disruptive.

Close the app and the preview pane

Close any program that had the file open. Then turn off File Explorer's preview, which holds files open on its own: in File Explorer, choose View, Show, and untick Preview pane.

End a background copy of the app in Task Manager

Press Ctrl + Shift + Esc. On the Processes tab, look for the app that last opened the file (Word, Excel, Photos, a video player). Select it and click End task. Try the file again.

Find the locking process in Resource Monitor

Press Windows + R, type resmon, and press Enter. On the CPU tab, expand Associated Handles and type part of the file name in the search box. The process holding the file appears below. Right-click it and choose End Process only if you know what it is; ending a system process can crash Windows or lose unsaved work in other programs.

Pause sync clients

OneDrive, Dropbox, and Google Drive lock files while uploading. Click the sync icon in the taskbar corner and pause syncing for a few minutes, then retry.

Check the network share

On a shared drive, the "another program" is often another person. Ask them to close the file, or have the server admin close it from Computer Management, Shared Folders, Open Files.

Sign out or restart

If nothing else works, sign out and back in, or restart. Every handle is released and the file is free.

If Word or Excel says the file is locked for editing. These apps write a hidden lock file named ~$ plus the document name in the same folder and delete it on close. After a crash it stays behind and keeps showing the message. Confirm the app is fully closed in Task Manager, show hidden files (View, Show, Hidden items), and delete the ~$ file.