关闭使用C#打开文件

编程入门 行业动态 更新时间:2024-10-24 03:22:42
本文介绍了关闭使用C#打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有那里的人都连接到文件共享上的情况,它的阻止我从覆盖文件。我试图写一个方法,将看看如果我提供了一个文件路径目前陷入了这种方式,并关闭该资源的网络会话。

I have a situation where people are connected to files on a share and it's blocking me from overwriting the file. I'm trying to write a method that will look to see if a filePath that I provide is currently locked in this way and close the network session of this resource.

我看了看ADSI WinNT提供,但Resources.Remove成员未实现。然后我看着Win32_ServerSession,虽然我可以使用删除成员,它杀死所有的资源给定用户。我需要弄清楚如何更具体。

I looked at the ADSI Winnt provider but the Resources.Remove member isn't implemented. Then I looked at Win32_ServerSession and while I am able to use Delete member, it kills all of the resources for a given user. I need to figure out how to be more specific.

我已经走GetRelationsShips和性能,但我只是在此刻难住了。

I've been walking GetRelationsShips and Properties but I'm just stumped at the moment.

推荐答案

这将是很难考虑这样做的所有后果,因为你不一定能预测结果,目前已锁定文件的应用程序的行为。

It would be difficult to consider all the ramifications of doing this because you can't necessarily predict the resulting behavior of the application that currently has the file locked.

有一些其他的方式来做到这一点?例如你有没有覆盖该文件向右走,或者你可以有不断地尝试覆盖该文件每隔几分钟,直到成功?

Is there some other way to do this? For example do you have to overwrite the file right away, or can you have some external process that continually tries to overwrite the file every few minutes until it succeeds?

更多推荐

关闭使用C#打开文件

本文发布于:2023-11-17 07:28:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609300.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!