使用C#访问联网计算机

发布于 2024-11-30 08:48:47 字数 342 浏览 7 评论 0原文

我构建了一个带有树视图的应用程序,显示了运行该应用程序的服务器的文件结构。我希望能够在树中包含通过网络连接的机器的文件结构。

类似于这个,但有多个工作组。

到目前为止,我发现的唯一类似的示例是 this 示例,它简单地列出了通过网络连接的计算机,而我想访问其中的文件夹。

预先感谢您的任何帮助

I have built an application with a tree view showing the file structure of the server the application is running on. I want to be able to include in the tree the file structure of machines connected through the network.

Something like this but with multiple workgroups.

The only example I have found which is similar so far is this example which simply lists machines connected through the network, whereas I want access to the folders within them.

Thanks in advance for any help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城月光淡如水﹏ 2024-12-07 08:48:47

假设进程作为有权访问共享的帐户运行,这将获得一个目录名称数组 (String[]):

var folders = Directory.GetDirectories(@"\\HOSTNAME\ShareName\");

您可以使用类似的方法将条目绑定到 TreeView。您需要更新您的问题以包含您正在使用的任何 UI 代码。

This will get an array of directory names (String[]) assuming the process is running as an account with access to the share:

var folders = Directory.GetDirectories(@"\\HOSTNAME\ShareName\");

You can use a similar method to bind the entries to a TreeView. You'd need to update your question to include whatever UI code you're using.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文