windows 是否可以通过编程找出哪个进程正在通过网络锁定文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/208283/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to programatically find out what process is locking a file across a network
提问by Xetius
I have a file on a Windows 2003 server which is locked by a process running on another Windows 2003 server. Is it possible to find out which process on which machine is locking this resource. I don't mind which language I use to do this.
我在 Windows 2003 服务器上有一个文件,该文件被另一台 Windows 2003 服务器上运行的进程锁定。是否可以找出哪台机器上的哪个进程正在锁定此资源。我不介意我用哪种语言来做这件事。
采纳答案by Daniel Silveira
http://technet.microsoft.com/en-us/sysinternals/bb897552.aspx
http://technet.microsoft.com/en-us/sysinternals/bb897552.aspx
PsFile
The "net file" command shows you a list of the files that other computers have opened on the system upon which you execute the command, however it truncates long path names and doesn't let you see that information for remote systems. PsFile is a command-line utility that shows a list of files on a system that are opened remotely, and it also allows you to close opened files either by name or by a file identifier.
...
How it Works
PsFile uses the NET API, which is documented in the Platform SDK.
ps文件
“net file”命令向您显示其他计算机在您执行该命令的系统上打开的文件的列表,但是它会截断长路径名并且不允许您查看远程系统的该信息。PsFile 是一个命令行实用程序,它显示系统上远程打开的文件列表,它还允许您按名称或文件标识符关闭打开的文件。
...
这个怎么运作
PsFile 使用平台 SDK 中记录的 NET API。