如何从C#访问ac $资源上的文件

Ove*_*ide 0 c#

我正在使用这样的示例:

System.IO.File.Copy("\\host\c$\folder\file.end", "c:\file.end", true);
Run Code Online (Sandbox Code Playgroud)

但我只获得带有描述的DirectoryNotFoundException

找不到路径'\ host\c $\folder\file.end'的一部分

如何访问DRIVE $资源上的文件?我在机器上拥有管理权限.

Bal*_*a R 5

尝试使用逐字字符串作为路径

System.IO.File.Copy(@"\\host\c$\folder\file.end", @"c:\file.end", true);
Run Code Online (Sandbox Code Playgroud)

或逃避斜线

System.IO.File.Copy("\\\\host\\c$\\folder\\file.end", "c:\\file.end", true);
Run Code Online (Sandbox Code Playgroud)