How To Resolve the “This Action Cannot Be Completed Because the File Is Open” Error
How to Fix “This action cannot be completed because the file is open” Error
Dealing with that annoying “This action cannot be completed because the file is open” message can be a huge pain, especially when you’re trying to delete, move, or rename a file but Windows just won’t let you. Usually, it’s because some process or app still has the file locked in the background. Sometimes, even when you close everything, Windows or Explorer gets a bit twitchy and keeps the file in some kind of limbo. The good news is, there are a handful of ways to untangle this mess without tearing your hair out. These fixes basically help you identify what’s holding the file hostage and free it up so you can finally do whatever you need. Once the process is ended or the cache cleared, modifying your file should be smooth sailing again. So, if you’re tired of seeing that error pop up, here’s some stuff to try—ranging from the quick and easy to a little more involved.
Causes of “This Action Cannot Be Completed Because the File Is Open” Error
This problem usually boils down to the file still being “in use” somewhere in the background. Sometimes it’s obvious (like a media player still playing that movie), but other times, Windows doesn’t realize the file is locked. Here’s what typically causes it:
- System File: Trying to delete core Windows files is a no-go unless you’re advanced enough to handle registry tweaks or booting from recovery. These files are usually protected for good reason.
- File in Use: Even when you close an app, some processes might still be holding onto that file. Background apps or services sometimes keep a hold, and Windows sees it as “in use.”
- Windows Explorer Isn’t Working Properly: If explorer.exe is glitchy, it might make files look “in use” even if they’re not. Restarting explorer often helps to clear that up.
- Thumbnails & Cache: Windows creates thumbnail previews and caches them for quicker access. Sometimes, these cached thumbnails keep files “locked” or in some limbo state.
- Preview Pane: When you have the preview pane enabled in File Explorer, it can sometimes make Windows think the file is still active or in use. Turning off the preview pane can fix this.
- Antivirus Software: During a scan or quarantine process, files might be held in a temporary safe mode, preventing changes until the scan is finished or the quarantine is cleared.
Fixes for “This Action Cannot Be Completed Because the File Is Open” Error
Not everyone needs full-blown technical skills for these, but some steps will involve digging into task managers or command lines. Here are some of the most reliable methods—pick whichever feels less intimidating or more applicable to the issue you’re facing.
Close the File Through Resource Monitor
This is a decent first shot because it pinpoints exactly what process is holding your file hostage. Plus, it avoids rebooting or messing around too much. You might think “how do I find what’s locking my file?” Well, Windows’ Resource Monitor can tell you if some process still has a handle on that file. Here’s the typical flow:
- Press Windows + R to open the Run box.
- Type
resmonand hit Enter. This opens Resource Monitor. - Switch over to the CPU tab.
- In the “Associated Handles” search box, type the exact filename or part of it (like the extension, e.g., “.mp4”).
- It will list processes that have a handle on that file. Select all relevant processes.
- Right-click and choose End Process. You might see a warning about closing processes, but just do it—sometimes it’s needed to unlock your file.
After that, the file usually gets freed up. Try your delete or move again. Sometimes, on some setups, you’ll need to repeat this if the process relapses or sneaky processes pop up again.
Restart Windows Explorer
Explorer.exe sometimes gets glitchy and keeps files “locked” even after you’ve closed everything. Restarting it resets the user interface and clears some of those phantom locks. To restart Windows Explorer:
- Open Task Manager. On Windows 10 and newer, hit CTRL + Shift + Esc. On Win7, it’s similar.
- Find Windows Explorer in the list. On Win10, click More Details if you see a simplified view.
- Right-click and select Restart. This should refresh Explorer, close any stuck processes, and release the file lock.
On Win7, it’s a bit different: you end the explorer.exe process, then go to File > New Task, type explorer.exe, and press Enter to restart it.
Reboot in Safe Mode
Sometimes, a full clean boot is needed because some app or process persists even after closing everything normally. Safe Mode loads Windows with the bare essentials, which is perfect for fixing stubborn file locks. To do it:
- Press Windows + R, type
msconfig, and hit Enter. - In the Boot tab, check Safe Boot and click Apply.
- Reboot your PC. Now, try to delete or move that troublesome file in Safe Mode.
Just remember, Safe Mode disables some drivers and background services, so don’t get too fancy with apps when you’re expecting a fix.
Deleting Temp Files
Temp files can sometimes hang onto your files or cause lock issues. Clearing temp data might free up enough space or remove cache locks. To clear temp files:
- Press Windows + R, type
%temp%, and Enter. - Highlight all the files (CTRL + A), then delete them with Shift + Del to skip the recycle bin.
- A few files might refuse to delete if in use—ignore those for now, and try again later.
Repeated temp cleaning can fix a bunch of odd Windows lock-ups.
End COM Surrogate Process (Windows 10 & 11)
This process handles thumbnail generation and can sometimes cause files to be registered as “in use.” Killing it temporarily might free your file. Here’s what to do:
- Open Task Manager (CTRL + Shift + Esc).
- In the Details tab, look for dllhost.exe, which is the COM Surrogate.
- Right-click and choose End Process.
Note: Restarting your PC afterward resets it, but if it keeps popping back up, you might need to disable thumbnail caching or related features.
Remove Thumbnails Cache with Disk Cleanup
Cached thumbnails can be a sneaky cause. Clearing that cache often solves “file in use” errors. Here’s how:
- Click the Start button, type Disk Cleanup, and open the app.
- Select your Windows drive (usually C:), then click OK.
- Wait for it to scan, then in the list, find and check Thumbnails and any other junk you want gone.
- Click OK to delete, then wait for it to finish.
After this, your thumbnail cache will reset, and Windows might think the file isn’t “in use” anymore.
Use Group Policy to Disable Thumbnails
If thumbnails are always a problem, you can tell Windows not to cache them at all. This involves the Group Policy Editor: – Note: This isn’t available on Windows Home, but you can enable gpedit via certain scripts or commands (like this: `GitHub Repository: Winhance`).To disable thumbnail caching:
- Press Windows + R, type
gpedit.msc, and hit Enter. - Navigate to User Configuration > Administrative Templates > Windows Components > File Explorer.
- Find and double-click Turn off caching of thumbnails in hidden thumbs.db files.
- Set it to Enabled, then click Apply and close the window.
This can prevent Windows from holding onto cached thumbnails that cause locking issues.
Disable the Preview Pane
Turning off the preview pane in File Explorer is straightforward and can fix the “file in use” illusion:
- Open any folder, then go to the View tab.
- Click on Preview Pane to toggle it off.
Or just press Alt + P while in an Explorer window. This stops Windows from trying to load previews that might keep files “active.”
Modify the File Using Command Prompt
When all else fails, CMD can be a straightforward way to delete or rename the file without Windows getting in the way. To delete:
- Open Command Prompt as Administrator (search for CMD, right-click, Run as administrator).
- Change to the drive where your file lives, e.g.,
E:. - Use the delete command:
Del— for example:\ Del E:\Example\one.txt
To rename:
- In the same elevated CMD window, navigate to the folder (
cd path\to\folder). - Type:
Rename old-filename.txt new-filename.txt
Sometimes, doing it this way bypasses any “file in use” checks.
Remove Files Quarantined by Antivirus
A file stuck in quarantine might block your attempts because Windows thinks it’s open or dangerous:
- Go to Settings > Update & Security > Windows Security.
- Click Virus & Threat Protection.
- Look under Current Threats for quarantined files.
- Select the file and click Start Actions, then choose Remove.
Once removed from quarantine, try deleting or modifying again.
Perform a Clean Boot
If you suspect some background app or service is locking your file, performing a clean boot can help isolate the cause. To do it:
- Open Task Manager (CTRL + Shift + Esc).
- Switch to the Startup tab.
- Disable all unnecessary startup items (right-click and choose Disable).
- Reboot your PC and try again.
After this, try the file modification once more. If it works, the culprit is likely some third-party app. You can enable startup apps one by one to identify which one is causing the lock.— Hopefully, one of these steps gets that file freed up. Windows can be weird sometimes, but with a little patience, most lock issues are fixable. Just keep in mind, sometimes it’s a process lingering in the background or a cached thumbnail making Windows think the file is still active.
- Verify if the file is truly open or just appears to be in use.
- Try rebooting your system if all else fails.
- Use specialized tools like Unlocker or Process Explorer for stubborn cases.