Determine which process (b)locks a file, programmatically (under Windows >= XP)
Posted
by fred-hh
on Stack Overflow
See other posts from Stack Overflow
or by fred-hh
Published on 2010-01-07T09:12:39Z
Indexed on
2010/03/28
22:43 UTC
Read the original article
Hit count: 293
How to programmatically determine from a process P, which other process P' has a lock on a file, that prevents P from recreating that file ?
I know there are tools to do that, but how do they achieve that ?
(Context: a batch program that runs overnight fails because of a locked file. Running an admin tool the next day may be too late to get useful information. So it would be nice if the batch program itself was able to determine the culprit.)
EDIT: Added complexity: the file resides on a DFS and P' might not run on the same machine as P (but maybe does). But a solution that works locally would be a good beginning.
© Stack Overflow or respective owner