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

前端 未结 6 972
渐次进展
渐次进展 2020-11-22 00:42

I\'ve seen several of answers about using Handle or Process Monitor, but I would like to be able to find out in my own code (C#) which process is locking a file.

I ha

6条回答
  •  心在旅途
    2020-11-22 00:58

    One of the good things about handle.exe is that you can run it as a subprocess and parse the output.

    We do this in our deployment script - works like a charm.

提交回复
热议问题