mklinkmklink

创建目录或文件符号或硬链接。Creates a directory or file symbolic or hard link.

语法Syntax

mklink [[/d] | [/h] | [/j]] <link> <target>

参数Parameters

参数Parameter 说明Description
/d/d 创建目录符号链接。Creates a directory symbolic link. 默认情况下,此命令将创建文件符号链接。By default, this command creates a file symbolic link.
/h/h 创建硬链接,而不是符号链接。Creates a hard link instead of a symbolic link.
/j/j 创建目录连接。Creates a Directory Junction.
<link> 指定正在创建的符号链接的名称。Specifies the name of the symbolic link being created.
<target> 指定新符号链接引用的路径 (相对或绝对) 。Specifies the path (relative or absolute) that the new symbolic link refers to.
/?/? 在命令提示符下显示帮助。Displays help at the command prompt.

示例Examples

若要创建和删除名为、MyFolder 和 Myfile.txt 的符号链接,请从根目录到 \Users\User1\Documents 目录,并在该目录中键入:To create and remove a symbolic link named, MyFolder and Myfile.file, from the root directory to the \Users\User1\Documents directory and a example.file located within the directory, type:

mklink /d \MyFolder \Users\User1\Documents
mklink /h \MyFile.file \User1\Documents\example.file
rd \MyFolder
del \MyFile.file

其他参考Additional References