Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Unlock a file locked by any process or system – How to do

by | Mar 29, 2021

Sometimes when we try to delete, rename or move a file in Windows, we may see a message ‘unlock a file locked by any process or system’.

Usually, the program name that keeps the file open, is shown right in the File Explorer message window. To unlock the file, it is enough just to close the program.

Here at Bobcares, we have seen several such Windows-related errors as part of our Server Management Services for web hosts and online service providers.

Today we’ll see how to unlock a file that shows busy/locked/used by another process.

 

How to unlock a file locked by any process or system

Here are the different methods our Support Engineers provide to our customers to unlock a file locked by any process or system.

 

Method 1: Unlock a File using Process Explorer

ProcessExplorer is a free tool from the Sysinternals kit. We can download it from the Microsoft website. Here is its URL:

https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer

Here is the procedure to find a process that has locked a file.

1. There is no need to install ProcessExplorer: we can simply download, extract and run procexp.exe as administrator
2. First, we select Find >> Find Handle or DLL (or press Ctrl-F)
3. Then we need to specify the file name that we want to unlock and then we click Search
4. Here, we select the file we want. The process has opened the file will be highlighted in the process tree. We right-click on it and select Kill Process Tree to end the process. However, we can try and close the file handle without ending the process. The filehandle we looked for is automatically highlighted in the Process Explorer bottom panel. We right-click the handle and select Close Handle. Finally, we confirm closing the file.

If the bottom panel with the list of open process handles is not displayed in Process Explorer, we enable the option View >> Lower Pane View >> Handles.

So we can close the file handle without ending the parent process. Then we can remove or rename the file.

 

Method 2: Release a File Handle using the Handle Tool

The handle is another command-line tool from the Sysinternals. We can download this as well from the Microsoft website.

URL: https://docs.microsoft.com/en-us/sysinternals/downloads/handle

It allows us to find a process having locked our file and release the lock by freeing the handle.

1. First, we download and extract the Handle archive

2. Next, we open the command prompt as an administrator and run the following command:

handle64.exe > listproc.txt

3. This command will save the list of open handles to a txt file. We can display handles for a directory the file we want to change is located in:

Handle64.exe -a “C:\Program Files\App”

or for the specific process:

handle64.exe -p excel.exe

4. Then we open listproc.txt in any text editor and find the line that contains the name of the locked file. We copy the file handle ID (in hex format). Then we go up to the section where the process that owns the handle is shown and write down its ID.

For some Windows system processes, handle.exe returns the following message:

wininit.exe pid: 732 \<unable to open process>

It means that we cannot get any information about these system processes (even as administrators). To get file handles open by such processes, we run the cmd.exe as System and try to get the list of handles again.

5. Then we get back to the command prompt and reset the file handle by its HandleID and ProcessID. Here is the command format:

handl64e.exe -c HandleID -p ProcessID

For example:

handl64e.exe -c 18C -p 18800

6. The tool will prompt to confirm the closing of the file for the process. We confirm it by pressing y >> enter.

If the system reacts to the closing of the file correctly, we will unlock the file without ending the process or restarting the server/computer.

[Need any further assistance in unlocking a locked file? – We are here to help you]

 

Conclusion

Today, we saw how our Support Engineers unlock a file locked by any process or system.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *