About 4 years ago we've published an article explaining how to unlock a file handle locked by SYSTEM or any other active process in Windows using three different techniques: the post hit more than 100k visits, showing how important the topic actually is for most Windows users. In this post, after a brief recap of these techniques, we'll try to explain what a "locked file" actually is and why abruptly unlocking it might be troublesome in some common scenarios.
How to unlock locked files
Let's start with a brief summary of the three main techniques that could be used nowadays to unlock a locked file on Windows.
- Unlocker: you can use Unlocker, a freeware application made by Cedrick Collomb, or IOBit Unlocker, a similar software made by IOBit (also freeware), to force Windows to release the lock on the file(s).
- Process Explorer: you can use Process Explorer by SysInternals to see all the currently active processes within your system, including the names of their owning accounts and a full list of handles (files) that the process selected in the top window has opened: the tool doesn't have an option to directly unlock these handles, but it will allow you to identify the process which is keeping the handle locked and close (or kill) it accordingly. Despite being a less-straightforward way to get the job done, I still consider it to be a better alternative than blindly using an "Unlocker" software because it gives you a better understanding of what's actually going on.
- Handle: Handle is basically a console version of ProcessExplorer (command-line options instead of the GUI) with a bunch of additional features to release locked handles instead of killing the whole process. It's arguably more complex to use, to the point that it might be overkill if you only need to "free" a bunch of non-critical locked files, but could come very handy if you're trying to fix some specific scenarios involving locked system files - as long as you know what you're doing.
All of the above tools can be trusted and don't contain malicious code, as long as you get them from their official download locations and avoid using a third-party website that might include some unwanted bloatware, grayware or even some malware in the installer file. If you wan to know more about the risks of downloading a software tool from untrusted third-party sources, read this post.
Is manual unlocking safe?
Let alone the security aspect of downloading and using the above tools, please keep in mind that the "safest" way to release a locked file and/or close a handle is either to close the locking app (or make it release the handle by closing the locked file) or shut down your PC: any manual attempt to force a process to close or an handle to be released might have a negative impact on your system and make it unstable, possibly even corrupting some data if the process or handle you're trying to close is performing I/O tasks.
Also, keep in mind that handles tend to be reused by Windows: therefore, whenever your close a handler that belongs to an app, it might be reassigned to some other app, thus causing unwanted behaviours.
For that very reason, you should rely to the above "unlocking" alternatives only if a graceful reboot is not an option and/or if you know what you're doing.
That's it, at least for now: I hope that this post might be useful enough to Windows users and System Administrators that are looking for a way to free locked files in a safe way.