我如何找出哪些过程是锁定使用.NET的文件? [英] How do I find out which process is locking a file using .NET?

查看:99
本文介绍了我如何找出哪些过程是锁定使用.NET的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过几个答案的有关使用处理或的进程监视器,但我希望能找到我自己的code(C#)
该方法是锁定的文件。

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.

我有我将不得不在Win32 API中spelunk围绕一个讨厌的感觉,但如果有人已经这样做,可以把我在正确的轨道上,我真的AP preciate帮助。

I have a nasty feeling that I'm going to have to spelunk around in the win32 API, but if anyone has already done this and can put me on the right track, I'd really appreciate the help.

  • How does one figure out what process locked a file using c#?
  • Command line tool
  • Across a Network
  • Locking a USB device
  • Unit test fails with locked file
  • deleting locked file

推荐答案

一个关于 handle.exe 的好东西是可以作为子进程运行并解析输出

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.

这篇关于我如何找出哪些过程是锁定使用.NET的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆