代码之家  ›  专栏  ›  技术社区  ›  Nathan Koop

从远程网络共享打开文件

  •  0
  • Nathan Koop  · 技术社区  · 15 年前

    我正在尝试从服务器打开文件

    Dim attachedFilePath As String = "\\myserver\myshare\test.txt"
    
    File.Open(attachedFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)
    

    这不会打开文件。

    但是,如果我将路径更改为本地路径,则没有问题。

    Dim attachedFilePath As String = "c:\...\test.txt"
    

    那么,有没有办法从远程存储打开文件?

    1 回复  |  直到 15 年前
        1
  •  7
  •   Chris Haas    15 年前

    Open用于读取文件的内容。使用Process.Start启动该文件类型的默认应用程序

    Dim Path = "\\myserver\myshare\test.txt"
    System.Diagnostics.Process.Start(Path)