使用文件识别进程 [英] Identify process using a file

查看:22
本文介绍了使用文件识别进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试弄清楚如何以编程方式识别锁定特定文件的进程.我已经搜索了 Win32 API 和 WMI,但到目前为止我找不到任何东西.我知道这是可能的 - Sysinternals 能够列出系统上每个进程访问/锁定的每个资源.

I have been trying to figure out how to programmatically identify the process that has a lock on a particular file. I've searched through the Win32 API and WMI, but so far I can't find anything. I know it's possible - Sysinternals is able to list every resource accessed/locked by every process on the system.

谁能给我一个提示?

推荐答案

您可以使用 handle来自 Sysinternals 的 .exe.

类似于:

> handle /accepteula C:\path\to\directory
...
program.exe           pid: 1234   type: File           2E4: C:\path\to\directory
...

感谢 https://stackoverflow.com/a/599268/367916.

这篇关于使用文件识别进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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