开发者

Open a file from a remote network share

开发者 https://www.devze.com 2022-12-16 16:17 出处:网络
I am trying to open a file from a server I currently have Dim attachedFilePath As String = \"\\\\myserver\\myshare\\test.txt\"

I am trying to open a file from a server

I currently have

Dim attachedFilePath As String = "\\myserver\myshare\test.txt"

File.Open(attachedFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)

This does not open a file.

However, if I change the path to be local then there is no issue.

Dim attachedFilePath As String = "c:\...\test.txt"
开发者_如何学C

So, is there a way to open a file from remote storage?


File.Open is for reading the contents of a file. Use Process.Start to launch the default application for that file type

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号