语言

File.CreateSymbolicLink(String, String) 方法

定义

创建一个指向 path 的文件 pathToTarget符号链接。

public:
 static System::IO::FileSystemInfo ^ CreateSymbolicLink(System::String ^ path, System::String ^ pathToTarget);
public static System.IO.FileSystemInfo CreateSymbolicLink(string path, string pathToTarget);
static member CreateSymbolicLink : string * string -> System.IO.FileSystemInfo
Public Shared Function CreateSymbolicLink (path As String, pathToTarget As String) As FileSystemInfo

参数

path
String

应在其中创建符号链接的路径。

pathToTarget
String

符号链接指向的目标的路径。

返回

包装 FileInfo 新创建的文件符号链接的实例。

例外

path 或 pathToTarget 为 null.

path 或 pathToTarget 为空。

-或-

path 或 pathToTarget 包含字符 null 。

文件或目录已存在于 path.

-或-

出现 I/O 错误。

适用于

另请参阅