Skip to content
tricknfixGAMING · TECHNOLOGIE · INFORMATIQUE
Create

Translation of the initial post. Replies remain in their original language. Read the original

#windows-11·Open questionTutorial

File cannot be deleted because it is open in another program: cause and solutions

Tutorial

You want to delete, rename or move a file, and Windows 11 refuses, saying it is open in a program? Windows protects a file as long as a process keeps it open: this is not a fault, but you need to identify that process. This guide offers a progression from the simplest to the most technical, with Microsoft's free tools (PowerToys File Locksmith, and Process Explorer and Handle from Sysinternals). The steps also apply to Windows 10, unless stated otherwise.

Problem

  • Windows shows a File In Use window when deleting, renaming or moving a file.
  • The message names a specific program, or only "another program".
  • The file stays locked even though the program seems closed.
  • A whole folder refuses to be deleted because a file inside it is open.

Typical message (the program name varies):

Plain text5 lines

File In Use
The action can't be completed because the file is open in Microsoft Word.
Close the file and try again.

Observe before acting

ObservationMost likely causeStep
The message names a programThat program has the file open, sometimes in a hidden or minimised windowStep 1
The message mentions "another program" or Windows ExplorerPreview, thumbnail or File Explorer window keeping the file openStep 2
The program is closed but the lock remainsProcess still running in the backgroundSteps 3 and 4
The lock disappears after a restart, then comes backProgram started at boot, sync or scan reopening the fileStep 5
The file is in the Recycle BinCovered in a dedicated guideRecycle Bin won't empty on Windows 11 (French guide)

Step 1: close the file in the named program

When to use it: the message gives the name of the program.

Suggested solution

  1. Save your work, then close the file in that program, or quit the program completely.
  2. Check the taskbar and the notification area (near the clock): some programs keep running after their window is closed.
  3. Click Try Again in the Windows window.

Expected result: the deletion, renaming or move succeeds.

Step 2: release File Explorer

When to use it: no program is named, or the message mentions Windows Explorer.

Suggested solution

  1. Close File Explorer's Preview pane and Details pane (View menu), which read the selected file.
  2. Close all File Explorer windows open on that folder.
  3. If the lock remains, open Task Manager (Ctrl + Shift + Esc), select Windows Explorer in the Processes tab, then click Restart task. The taskbar disappears for a few seconds, which is normal.
  4. Try the operation again.

Expected result: the file is deleted. Otherwise, restarting the PC releases all open files: it is the simplest solution if you don't need to know which program was locking it.

Step 3: find the program with PowerToys File Locksmith

When to use it: you want to know which process is locking the file, on Windows 11 or Windows 10 (version 2004 or later).

File Locksmith is a Microsoft PowerToys module that shows the processes using a file or folder.

Suggested solution

  1. Install PowerToys from the Microsoft Store, the project's GitHub page, or with the following command in a terminal:
PowerShell3 lines

winget install --id Microsoft.PowerToys --source winget
  1. In the PowerToys settings, check that File Locksmith is enabled.
  2. In File Explorer, right-click the locked file or folder, then Show more options and Unlock with File Locksmith.
  3. If the list is empty while the file is locked, click Restart as administrator: File Locksmith can then see the processes of all users and services.
  4. Find the process. Preferably, close the program normally. As a last resort, use End task in File Locksmith, knowing that the program's unsaved changes will be lost.
  5. Click Reload to check that the list is empty.

Expected result: no process is listed any more and the operation on the file works.

Rollback: PowerToys can be uninstalled like any app, from Settings > Apps > Installed apps.

Step 4: search for the file with Process Explorer or Handle

When to use it: you don't want to install PowerToys, or you prefer Microsoft's Sysinternals tools (no installation needed).

Suggested solution

Process Explorer (graphical interface)

  1. Download Process Explorer from Microsoft's Sysinternals page (the current version requires Windows 11 or later), extract the archive and run it as administrator.
  2. Open the Find menu, then Find Handle or DLL (Ctrl + F).
  3. Type part of the locked file's name, then start the search.
  4. Note the process shown, then close that program normally.

Handle (command line)

  1. Download Handle from the Sysinternals page and extract it, for example to C:\Outils.
  2. Open Command Prompt as administrator (Handle requires it), then type part of the file name:
Batch3 lines

C:\Outils\handle.exe rapport.docx
  1. The output shows the process name and its PID (identification number) for each matching open file.

Expected result: you know which program is locking the file and can close it.

Process Explorer and Handle can also force-close a "handle" (a program's access to the file). Microsoft warns that this can make the program, or even the system, unstable, with a risk of losing unsaved data. Always prefer closing the program normally or restarting.

Step 5: lock that comes back at every startup

When to use it: the file is released after a restart, then gets locked again.

Suggested solution

  1. Identify the process with step 3 or 4.
  2. If it is a sync service (OneDrive, for example), pause syncing during the operation. See also OneDrive no longer syncs files on Windows (French guide).
  3. If it is a program started at boot, temporarily disable its automatic startup in Task Manager > Startup apps, restart, then delete the file.
  4. If it is a program you want to remove but that refuses to uninstall, see Program that cannot be uninstalled on Windows (French guide).

Expected result: the file is deleted. Then re-enable automatic startup or syncing if you need it.

Special cases

SituationWhat to do
The message says access denied rather than file openThis is not a lock but a permissions problem (owner or NTFS permissions of the folder): the tools in this guide won't change anything. See Access denied to a folder in Windows 11.
The file is a program currently in useQuit the corresponding program, including from the notification area, before deleting its file.
The locking process is SystemOften a network share or access from another PC: close the file on the other device, or restart.
File Explorer freezes during the operationSee Windows 11 File Explorer is slow, freezes or closes by itself (French guide).

Final check

  • ☐ The program that was locking the file is identified or closed.
  • ☐ The file is deleted, renamed or moved without a message.
  • ☐ No handle was force-closed on a file being written.
  • ☐ Paused automatic startup or syncing has been re-enabled if needed.

Sources

Still having the problem?

Reply in this topic with your Windows version (Windows + R keys, then winver), the exact message, the file type and its location (internal drive, USB stick, OneDrive folder, network share), and the name of the process found by File Locksmith, Process Explorer or Handle. Replace your user name with "USER" in paths.

Have an idea or a suggestion?

Be the first to join the discussion.

Reply

Reply without signing up using a TNF_… username saved on this device. You can post once every 30 minutes until you verify your email.

Add a GIF

Up to 5 GIFs per message.

Your draft stays on this device while you write.