开发者

How to get the name of the process which locks a specfic file? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicates:

How does one figure out what process locked a file using c#?

How do I find out which process is locking a file using .NET?

Hi,

i try to get the name of the process wich locks a file (not only a dll module, any file). For example if process "Process A" opens a file stream on "C:\temp\test.txt" this should be detected (if i try to delete the file in windows explorer it is locked till the process is killed).

There are several examples on Stackoverflow like: How does one figure out what process locked a file using c#?

Determine which process (b)locks a file, programma开发者_Go百科tically (under Windows >= XP)

I tryed the examples above, but none of them works.

I also read somethink about the Win32 API function NtQuerySystemInformation, but i don't know how how to use it. Couldn't find any PInvoke code for it.


I use Process Explorer from SysInternals (It doesn't not require installation, it's a single exe).

  1. Ctrl+F (Find handle or dll)
  2. Type the name of the locked file


As already mentioned in the comment (by bzlm and Richard), handle.exe should work for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜