How to find out what processes have folder or file locked?
Asked Answered
I

4

10

How do you go about querying running processes to find out what folders or files they have locked? (i.e. you go to eject a drive and you're told that it can't be ejected because it's in use)

I'd like to either get an "off the shelf" download, or write a .NET 3.5 app to do this (primarily a Windows question).

Indistinctive answered 5/7, 2009 at 17:34 Comment(1)
#226302Nobelium
S
27

Process Explorer will show you this. Ctrl-F will let you search for a file and list the process(es) that have that file open/locked. You can then close that handle using Process Explorer.

There's also a command line utility called oh.exe available for download. See here for more details

Serosa answered 5/7, 2009 at 17:54 Comment(3)
Process Expolorer is my tool of choice for this. It also allows you to close the handle.Laughter
Good point re. the handle closing. I'd forgotten that. Answer amendedSerosa
However, don't close the handle unless you're willing to have the program crash, freeze, burn your house down or hold all your data ransom. The program won't expect the handle to close until it decides to close it, so who knows what havoc it will cause when this assumption is violated :)Tenner
I
6

LockHunter is a great context menu tool for Windows.

Indistinctive answered 6/2, 2013 at 22:38 Comment(2)
Good tool - just does what it says!Insoluble
This is good when you don't know which file in a folder has a lock. It will tell you the locks on any files within a folder or drive.Jenifer
D
2

One of the first things I put on my Windows dev machines is WhoUses. It's nice because it's open source too.

Discredit answered 5/7, 2009 at 19:4 Comment(1)
Link is broken :(Ditzel
L
0

http://www.emptyloop.com/unlocker/ (freeware) has a special UI for exactly this situation.

Lymphoblast answered 5/7, 2009 at 18:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.