14 March 2019

How to Delete a File in Use by Another Program


delete-file

Windows File Explorer claims the file you’re trying to delete is open in another program or the system? When you can’t open, edit, or delete a file, it’s either still running in the background or didn’t close properly.

Fortunately, you can force close, rename, move, or delete a file that is in use. Here’s how!

How to Overcome the “File in Use” Error

If you want to skip the manual solutions, scroll down to the section where we list tools that can help you unlock and delete a file in use.

Windows file in use in other program or system.

1. Close the Program

Let’s start with the obvious. Did you just open the file and not close it? If the file is closed, but the program is still running, close it too, then try again.

2. Reboot your computer

While rebooting is inconvenient, it requires zero skills or fiddling with stuff like the Task Manager or third party tools. Rebooting also clears your RAM and possibly fixes other nuisances in one go. So try this if you can’t be bothered to look into the cause.

Reboot Windows computer.

If you have already tried rebooting and it didn’t help, skip to the next option.

3. End the Application via the Task Manager

The reason rebooting helps is because the system will start from scratch and—among other things—all processes currently running in the Task Manager will be closed. Instead of rebooting, you can also try to manually end the process or application that holds your file hostage. This is the most successful method to fix the “file is open in another program” error.

Click Ctrl + Shift + ESC to open the Task Manager. Alternatively, you can right-click the Taskbar or click Ctrl + Alt + Del anywhere in Windows and select Task Manager. If you see the compact Windows 1o version, click More details and make sure you’re in the Processes tab. Now browse for the application that you used to open the “file in use”. For example, if you were viewing a document, look for Word.

Windows 10 Task Manager

Once you find the process, select it and click End task in the bottom right. This will close all instances of the program. If you cannot seem to find the process, have you tried rebooting, yet?

4. Change File Explorer Process Settings

By default, File Explorer launches all its windows in a single process (explorer.exe). It could be, however, that your settings force File Explorer to launch separate processes, which could cause a conflict between different processes.

Press Windows + E to open File Explorer. Go to View > Options > Change folder and search options.

Change folder and search options in Windows File Explorer.

In the Folder Options window, switch to the View tab and find the Launch folder windows in a separate process option. Make sure it’s not checked. Click Apply to save any changes.

If the option was unchecked in the first place, you could try if checking it solves your issue.

5. Disable the File Explorer Preview Pane

Previews in the File Explorer can cause conflicts like the “file is open in another program” error.

Press Windows + E, switch to the View tab, and press Alt + P to close the preview pane. The screenshot below shows an open preview pane on the right.

Close Windows File Explorer preview pane.

After closing the preview pane, try the operation again and see whether the “file in use” error has disappeared.

6. Force Delete the File in Use via the Command  Prompt

You can bypass the File Explorer and force delete the file using the command prompt.

First, we need to track down the file path directory in File Explorer. Press Windows + E to open file explorer, locate the affected file, and copy the file path.

Find file path in Windows File Explorer.

Now press Windows + S, search for Command Prompt, right-click the respective result, and select Run as administrator. To navigate to the file directory of your file in use, enter cd [directory path you copied] and hit Enter.

Navigate to file path in Windows Command Prompt.

Before we can proceed and force delete the file in use, we have to temporarily kill the File Explorer process. This will cause your Taskbar, wallpaper, and open folders to disappear. But don’t worry, you can restart File Explorer and we’ll show you how below.

To close File Explorer, press Ctrl + Shift + ESC, find Windows Explorer, right-click the process, and select End task.

End Windows File Explorer task in Task Manager.

Return to the Command Prompt. If you lost the window, press Alt + Tab to jump to it.

Enter this command to delete the file, replacing everything between the quotes with your actual file name: del "File in Use.doc"

Delete file in Windows command prompt.

To restart the File Manager, open the Task Manager (Ctrl + Shift + ESC), click File > Run new task, enter explorer.exe, and click OK. This should restore your desktop to its usual appearance.

Unlock the File in Use With a Tool

Sometimes, the file in use remains locked, even though it shouldn’t be. If trying to delete it through the Command Prompt didn’t work or if that task is too daunting, use one of these tools.

1. Microsoft Process Explorer

Process Explorer is a more powerful File Explorer. It doesn’t just list all running processes, it can also show you which process took your file hostage. Simply open the Process Explorer Search via Find > Find Handle or DLL (or press Ctrl + F), enter the file name, and wait for the list of processes accessing your file.

Process Explorer Search

You can’t close the process from the search window, but you can use Process Explorer or Windows Task Manager to close the offending application.

2. Unlocker

Unlocker used to add itself to the Windows context menu, meaning you could right-click the file in use and unlock it via the context menu.

In Windows 10, launch Unlocker, browse for the file, select the file, and click OK. Unlocker will look and (if found) remove locking handles. Even if it does not find a handle, you can use Unlocker to Delete, Rename, or Move the file.

Delete, Rename, Move file in use with Unlocker.

Should the file still be in use, you can let Unlocker perform the action upon your next reboot.

Unlocker Error

3. LockHunter

LockHunter will add itself to the Windows context menu. Once installed, just right-click the locked file and select What is locking this file? This should bring up a window showing all processes using the file. You can now select to Unlock, Delete (at next system restart), or Unlock & Rename the file. In our case, we couldn’t unlock the file, but deleting it at the next system restart did work.

Delete File in Use with LockHunter.

Another third-party tool, FilExile, failed to delete our file in use, even though it reported success. However, if your file path is too long, you might still want to give this tool a try.

File Still in Use? Boot Into Safe Mode

If the above didn’t work or if you’re not interested in installing software, there is one last thing you can try: boot into Windows Safe Mode. The file you’re trying to delete may automatically be loaded by another application. Unlockers should still work if that’s the case, but if malware is involved or if you don’t want to deal with third-party tools, this is an alternative route you can take.

In Windows 10, press Windows + I, navigate to Update & Security > Recovery and under Advanced startup select Restart now. From the next screen, select Troubleshoot > Advanced Options > Startup Settings > Restart. When your computer reboots, you’ll see the Startup Settings screen, from where you can choose Safe Mode.

Once you’re in Safe Mode, navigate to the file in question and try your luck once more.

More Windows File Explorer Tricks to Know About

We showed you a few ways to unlock a file open in another program or in use by the system. Hopefully, one of them worked. Two methods involved the Windows File Explorer.

Did you know about these Windows File Explorer features:

Image Credit: Jane0606/Shutterstock

Read the full article: How to Delete a File in Use by Another Program


Read Full Article

No comments:

Post a Comment