简体   繁体   English

正在使用WINDOWS / system32 / LogFiles。 我如何发现正在使用什么程序? 如果是服务器,我也该如何使用它?

[英]WINDOWS/system32/LogFiles in use. How can I discover what program is using it? If it's the server, how can I use it too?

opening a file in WINDOWS/system32/LogFiles with 使用以下命令在WINDOWS / system32 / LogFiles中打开文件

    using (StreamReader r = new StreamReader(fileName))

generates exception "because the file is in use by another process". 生成异常“因为文件正在被另一个进程使用”。 How can I figure out what the other process is? 我如何确定其他过程是什么? Could it be the server updating the logs? 是服务器更新日志吗? If it is, how can I ensure that my associated scheduled task can also have access? 如果是,我如何确保相关的计划任务也可以访问?

thanks! 谢谢!

I'm afraid I don't have the auth to install programs on this server. 恐怕我没有在该服务器上安装程序的身份验证。

This is disturbingly old school, but I love this really bad utility called: wholockme http://www.dr-hoiby.com/WhoLockMe/ 这是一所令人不安的老学校,但我喜欢这个非常糟糕的实用程序:wholockme http://www.dr-hoiby.com/WhoLockMe/

It lets you know who has files locked. 它可以让您知道谁锁定了文件。

Jacob 雅各布

Personally, I prefer ProcessExplorer with its "Find Handle" functionality. 就个人而言,我更喜欢具有“查找句柄”功能的ProcessExplorer

You could also try opening a file in a shared mode: 您也可以尝试以共享模式打开文件:

using (FileStream fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (StreamReader r = new StreamReader(fs))
    ... 

If you want to find out who has the file open, my favorite app for this is Handle by SysInternals ( http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx ). 如果要找出打开文件的人,我最喜欢的应用程序是SysInternals的Handle( http://technet.microsoft.com/zh-cn/sysinternals/bb896655.aspx )。 I know you said you don't have authority to install apps, this is just a single executable that you run, and you could run it from a network share if you wanted. 我知道您说您没有安装应用程序的权限,这只是您运行的单个可执行文件,并且您可以根据需要从网络共享中运行它。

I've had the LogFiles lock problem with SMTP service logs, my solution was just to copy the file to another location and open it from there. 我在SMTP服务日志中遇到LogFiles锁定问题,我的解决方案是将文件复制到另一个位置,然后从那里打开它。 Might work for what you're doing. 可能会为您所做的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM