Home » Questions » Computers [ Ask a new question ]

Find out which process is locking a file or folder in Windows

Find out which process is locking a file or folder in Windows

How can I find out which process is locking a file or folder in Windows?

Asked by: Guest | Views: 57
Total answers/comments: 5
Guest [Entry]

"PowerShell method:
IF((Test-Path -Path $FileOrFolderPath) -eq $false) {
Write-Warning ""File or directory does not exist.""
Else {
$LockingProcess = CMD /C ""openfiles /query /fo table | find /I """"$FileOrFolderPath""""""
Write-Host $LockingProcess

The openfiles command needs to have support for local files enabled, by running openfiles /local on and restarting.
More details How to find out which process is locking a file or folder in Windows archive"
Guest [Entry]

"A couple of options:

Microsoft/SysInternals Process Explorer - Go to Find > Find Handle or DLL. In the ""Handle or DLL substring:"" text box, type the path to the file (e.g. ""C:\path\to\file.txt"") and click ""Search"". All processes which have an open handle to that file should be listed.

WhoLockMe - Explorer extension which adds a right-click menu option

N.B. WhoLockMe appears to not work with Win 10 (at least I have been unable to register it with either of the 32- or 64-bit versions of regsvr32.exe)."
Guest [Entry]

"EMCO UnlockIT can identify the process that has locked the file as well as unlock the file so that you may delete/edit/move it. The program is completely free, though the newer version is a bit slower and more bloated than the original (which had a plain, unskinned GUI, but loaded pretty much instantaneously and without an annoying splash screen). Also, the original version used to pop up automatically whenever the error you mentioned is triggered, allowing you to instantly unlock the file and perform the operation you were attempting.

Still, UnlockIT is an incredibly useful program that provides a basic functionality that is critically missing from Windows. It's among the standard toolkit of utilities that I install on all Windows computers I work on."
Guest [Entry]

"A lot of the programs here are outdated. I finally ended up using nirsoft's OpenedFilesView which worked really well.

Though the best part is the explorer menu integration, which is easy to enable. As per website

Explorer Context Menu
Starting from version 1.10, you can launch
OpenedFilesView directly from Windows Explorer, and view only the
handles of the file or folder that you want to inspect. In order to
enable this feature, check the 'Enable Explorer Context Menu' under
the Options menu. After you enable this feature, you can right-click
on any file or folder on Windows Explorer, and choose the
'OpenedFilesView' item from the menu. If you run the OpenedFilesView
option for a folder, it'll display all opened files inside that
folder. If you run the OpenedFilesView option for a file, it'll
display all opened handles for that file.

This tool still works reliably in 2019"
Guest [Entry]

If you do not know the program the file it is using then you can go to My Computer; right click; select Manage. Under System Tools > Shared folders > Open Files, you should be able to see the user who has locked the file. You can close file from here and then you can perform the task of rename or delete the file. Hope this helps