How to Find What is Holding a File Open and How to Close or Kill the Process

When you are working with files such as documents, spreadsheets, photos, videos and so on, they are loaded into your computer’s memory (RAM) as you work on them. Then when you close the file, it is released from memory so it can be used for other files and programs. But sometimes you will find that you have closed a file and want to move or delete it but get a message that you cannot because the file is in use.

Often the only way to get around this is to reboot your computer or maybe you can get lucky and kill the program or process that was used to open that file. But nobody wants to have to close all the programs and files to reboot just to move or delete a single file. In this article, we will be showing you how to find what is holding a file open and how to close or kill the process responsible for keeping it open.

If closing the program that was used to open the file does not release its hold on that file, there is a way you may be able to find the offending app and close it using a tool built into Windows. There are also third party apps you can use to find what else might be accessing that file and then kill the process to free up the hold on that file.

The tool you will use to find what is holding a file open will depend on the type of file. The image below shows an ISO file that says it’s in use by a process called System. When you try and delete the file for example, you get a message that says, “The action can’t be completed because the file is open in System”. This message is not too informative unless you happen to know what System is.

How to Find What is Holding a File Open and How to Close or Kill the Process

To find what program or process has this file locked and preventing it from being able to be deleted, we will be using a free program called Opened Files View. There is nothing to install and all you need to is download the zip file, extract it and run the OpenedFilesView.exe file.

The Opened Files View tool has many columns of information such as file name, handle, path, file position, process ID, process user and more. You can drag and drop the column headers to rearrange them or add or remove columns as needed.

After opening the tool and sorting by filename, we were able to find the ISO file that we are unable to delete in the list. We can then see the process name (System process) as well as the file handle and other information.

How to Find What is Holding a File Open and How to Close or Kill the Process

When right clicking on the file in question, you have several actions that you can take on the file.

How to Find What is Holding a File Open and How to Close or Kill the Process

Here are what some of the more important options do.

  • Bring Process to Front – This will make the program that is using the file active so you see it (if possible).
  • Close Selected File Handles – File handles are unique identifiers assigned by the operating system to track and manage open files or other I/O resources like sockets or devices. Closing the file handle is a way to attempt to close the file so you can take action on it.
  • Copy Locked Files to Another Folder – If you cannot move, close or delete the file, you can make a copy of it in another location and then do what you need to do with it.
  • Close Processes of Selected Files – This option will try and close the process holding the file gracefully to release the hold on the file.
  • Kill Processes of Selected Files – If you can’t close the process that is using the file, you can use this option to force it closed. Just keep in mind that it may result in data loss if you are unable to save your work.

Here is a video demonstrating how the Opened Files View app works.

The image below shows another example of a locked file, This time it tells you that the file is open in Microsoft Word which makes it easier to close the program that has it open. But sometimes you may come across a situation where the program is closed yet the file is still locked in use.

Locked file

If you know how to use Task Manager, you can open that up and find the Microsoft Word or WINWORD.exe process and right click on it and choose Kill Process.

Windows Resource Monitor

If you do not know what program has the file locked, you can also try to open the Windows Resource Monitor tool to find out. Once you have Resource Monitor open, click on the CPU tab and then in the section labeled Associated Handles, there is a box where you can type in the name of the locked file and search for it.

If it is able to find it, you will be shown the process or program that has the file locked open as well as its PID (Process ID). You can then right click on the process name in the Image column and choose End Process to release the hold on the file.

Here is a video showing this process.

As you can see, there are several ways to find what is holding a file open and how to close or kill the process.

For additional training resources, check out our online training courses.

Related Posts

© 2024 Online Computer Tips
Website by Anvil Zephyr