Need help?

Our experts have had an average response time of 11.7 minutes in August 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 *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF