語言

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 錯誤。

適用於

另請參閱