Command-line tool for finding out who is locking a file

WindowsCommand LineLocking

Windows Problem Overview


I would like to know who is locking a file (win32). I know about WhoLockMe, but I would like a command-line tool which does more or less the same thing.

I also looked at this question, but it seems only applicable for files opened remotely.

Windows Solutions


Solution 1 - Windows

Handle should do the trick.

> Ever wondered which program has a particular file or directory open? > Now you can find out. Handle is a utility that displays information > about open handles for any process in the system. You can use it to > see the programs that have a file open, or to see the object types and > names of all the handles of a program.

Solution 2 - Windows

handle.exe http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

THis has helped me sooooo many times....

Solution 3 - Windows

Download Handle.

https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx

If you want to find what program has a handle on a certain file, run this from the directory that Handle.exe is extracted to. Unless you've added Handle.exe to the PATH environment variable. And the file path is C:\path\path\file.txt", run this:

handle "C:\path\path\file.txt"

This will tell you what process(es) have the file (or folder) locked.

Solution 4 - Windows

enter image description here

Computer Management->Shared Folders->Open Files

Solution 5 - Windows

Handle didn't find that WhatsApp is holding lock on a file .tmp.node in temp folder. ProcessExplorer - Find works better Look at this answer https://superuser.com/a/399660

Solution 6 - Windows

In my case Handle.exe did not help. Simple program from official Microsoft called Process Explorer was useful. Just open as administrator and press Ctrl+f, type part of file name it will show process using file.

Solution 7 - Windows

I have used Unlocker for years and really like it. It not only will identify programs and offer to unlock the folder\file, it will allow you to kill the processing that has the lock as well.

Additionally, it offers actions to do to the locked file in question such as deleting it.

> Unlocker helps delete locked files with error messages including "cannot delete file," and "access is denied." Video tutorial available. > > Some errors you might get that Unlocker can help with include: >

  • Cannot delete file: Access is denied.
  • There has been a sharing violation.
  • The source or destination file may be in use.
  • The file is in use by another program or user.
  • Make sure the disk is not full or write-protected and that the file is not currently in use.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJesperEView Question on Stackoverflow
Solution 1 - WindowsfheView Answer on Stackoverflow
Solution 2 - WindowswebclimberView Answer on Stackoverflow
Solution 3 - WindowsMacGyverView Answer on Stackoverflow
Solution 4 - WindowsHalimView Answer on Stackoverflow
Solution 5 - WindowsPawel CiochView Answer on Stackoverflow
Solution 6 - WindowsAugustasView Answer on Stackoverflow
Solution 7 - WindowsgwnpView Answer on Stackoverflow