Create Symbolic Links, Hard Links and Directory Junctions in Vista with MKLINK创建符号链接,硬链接和目录路口,在Vista与mklink
For Unix-like or Linux system users, symbolic link is a common feature in use almost daily.为Unix的一样,或Linux系统的用户,符号链接的一个共同特点是在使用中几乎每天都有。 Symbolic link (aka soft link) or symlink as it often shortened to, is a special type of file or file-system object that serves as a reference or points to another file, UNC or directory, known as target.符号链接(又名软链接)或符号连结,因为它往往缩短,是一种特殊类型的文件或文件系统的对象提供了一个参考或点到另一个文件,联合国军司令部或目录,被称为目标。 In Windows Vista, symlinks feature has been added to NTFS filesystem and can be created by using MKLINK command.在Windows Vista中,符号连接的功能已添加到NTFS的文件系统和可以创造出用mklink指挥。 In previous Windows operating system, the closer thing to symbolic links is NTFS junction point, or worse, Windows shell shortcut (.lnk) file.在以往的Windows作业系统,更密切的事,符号链接是NTFS交界点,或更糟的是, Windows Shell中的捷径( 。 lnk )文件。
Symlink in Vista, unlike .lnk shortcut in desktop or Windows Explorer, allow user to access files within the symbolic link created itself via explorer, the console and etc. And symbolic link also differ from NTFS junction point which can only link to folders and volumes, in which symlinks can point to a file, a UNC, a folder or a volume, as well as able to span file systems.在Vista中的符号连接,不像。 lnk快捷方式在桌面或Windows档案总管中,允许使用者存取档案内的符号链接,创造本身通过Explorer中,控制台等和符号链接,也不同于NTFS的交界点,只能链接到的文件夹和卷,在这种符号链接可以指向一个文件,一个UNC ,一个文件夹或卷,以及能够跨度档案系统。
Symbolic link is useful when you have a lot of folders and files are scattered all over the directory tree, and you need to manage them from a single location.符号链接是有用的当您有很多的文件夹和文件,分散在各地的目录树,并且您需要管理,他们从一个单一的位置。 Another scenario is that you have a deep nested file that you want to access quickly instead of traverse through one branch by one branch.另一种情况是,你有深刻的巢式文件,您要访问的快速而不是导线通过一科一科。 And furthermore, for programmer, symlink provides a static file path that can be point to a ever changing object without affecting the functionality of the program.此外,为程序员,符号连接提供了一个静态的文件路径,可以指向一个不断变化的对象在不影响功能的程式。 In all these situation, symbolic links can be created at a convenient location which point to the ‘real’ objects.在所有这些情况下,象征性的联系,才能创造一个方便的位置,这点'真正的'对象。
As mentioned, to create a symbolic link, use MKLINK command line tool.如上所述,创建一个符号链接,使用mklink命令行工具。 MKLINK can be used to create a hard link or directory junction too. mklink可以用来创建一个硬链接或目录的交界处。 Hard link is essentially giving another name or label to the objects, while NTFS directory junction point is used to redirect the whole folder to another folder as if it’s the original folder itself.硬链接,基本上是给另一个名称或标签的对象,而NTFS目录交界点是用来重定向整个文件夹到另一个文件夹,因为如果它的原始文件夹本身。 Junction point is used extensively in Vista to provide support for old directory structures for user profiles (ie Documents and Settings) to point to the new user folders located inside Users directory.交界点是广泛使用在Vista中提供支持的旧目录结构为用户配置文件(即文件和设置)以指向新的用户文件夹内的用户目录中。
Syntax and Options of MKLINK 语法和选择mklink
MKLINK [[/D] | [/H] | [/J]] Link Target mklink [ / ] | [ /小时] | [ / j ]链接目标
/D - Creates a directory symbolic link. / -创建一个目录的符号链接。 Default to file symbolic link.默认文件符号链接。
/H - Creates a hard link instead of a symbolic link. /小时-创建一个硬链接而不是一个符号链接。
/J - Creates a Directory Junction. / j -创建一个目录交界处。
Link - Specifies the new symbolic link name.链接-指定新的符号链接的名字。
Target - Specifies the path (relative or absolute) that the new link refers to.目标-指定的路径(相对或绝对)说,新的联系是指。
Examples and Usages of MKLINK 例子和用法mklink
Note: Only Administrators can use MKLINK to create symbolic links unless override by using secpol.msc, so you need to run Command Prompt with elevated privileges, or else you will get “You do not have sufficient privilege to perform this operation.” error.注意:只有管理员可以使用mklink创建符号链接,除非凌驾使用secpol.msc ,所以你需要运行命令提示符以提升的权限,否则,你会得到“您没有足够的权限执行此操作。 ”错误。
To create symbolic link called foo to reference to c:\Windows\System32\notepad.exe:创建符号链接名为foo参考到C : \的Windows \ system32 \记事本:
C:\test>mklink foo c:\Windows\System32\notepad.exe为C : \测试> mklink富为C : \的Windows \ system32 \记事本
You will see the following result:您会看到下面的结果:
symbolic link created for foo <<===>> c:\Windows\System32\notepad.exe象征性的联系创造了富<<===>>为C : \的Windows \ system32 \记事本
If you type dir in commnd prompt, you will see the following listing:如果您键入dir在commnd提示符下,您会看到下面的名单:
Volume in drive C has no label.货量在驱动器C并没有标签。
Volume Serial Number is 2211-7428卷序号是2211-7428Directory of C:\test目录为C : \测试
04/14/2006 11:24 AM <DIR> . 2006年4月14日上午11时24分<dir> 。
04/14/2006 11:24 AM <DIR> .. 2006年4月14日上午11时24分<dir> ..
04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 2006年4月14日上午11时24分<symlink>富[为C : \的Windows \ system32 \记事本]
1 File(s) 0 bytes 1档( ) 0字节
2 Dir(s) 69,238,722,560 bytes free二迪尔( ) 69,238,722,560字节免费
To create symbolic link to a folder, simply use /D switch:创建符号链接到一个文件夹,只需使用/ d开关:
C:\test>mklink /d bar c:\windows为C : \测试> mklink /酒吧为C : \的Windows
symbolic link created for bar <<===>> c:\windows符号链接,创造酒吧<<===>>为C : \的Windows
Results of dir command:结果dir命令:
Volume in drive C has no label.货量在驱动器C并没有标签。
Volume Serial Number is 2211-7428卷序号是2211-7428Directory of C:\test目录为C : \测试
04/14/2006 11:24 AM <DIR> . 2006年4月14日上午11时24分<dir> 。
04/14/2006 11:24 AM <DIR> .. 2006年4月14日上午11时24分<dir> ..
04/14/2006 11:24 AM <SYMLINKD> bar [c:\windows] 2006年4月14日上午11时24分<symlinkd>酒吧[为C : \的Windows ]
04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 2006年4月14日上午11时24分<symlink>富[为C : \的Windows \ system32 \记事本]
1 File(s) 0 bytes 1档( ) 0字节
3 Dir(s) 69,238,722,560 bytes free三迪尔( ) 69,238,722,560字节免费
MKLINK cannot use to delete symbolic link. mklink不能使用删除符号链接。 To remove a symbolic link, simply delete them as if you’re removing a normal file.要删除一个符号链接,只需删除它们,因为如果您删除一个正常的文件。 For example, to delete the foo symbolic link created above, enter the following command:例如,要删除富象征性的联系创造了上述情况,输入以下命令:
C:\test>del foo为C : \测试>删除富
To remove the bar symbolic link to a folder created above, use the following command:删除酒吧符号链接到一个文件夹中创建以上,使用下列命令:
C:\test>rd bar为C : \测试>路酒吧
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要说明 :这是一个机器翻译网页是“按原样”提供的担保。 Machine translation may be difficult to understand.机器翻译可能很难理解。 Please refer to请参阅 original English article英文原版的文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和贡献,或取得技术的支持和帮助,在 My Digital Life Forums 我的数字生活论坛 . 。
Related Articles相关文章
- 10 New Executables and 20 Old Commands in Windows Vista 10个新的可执行文件和20岁的命令在Windows Vista
- Restore Missing or Deleted Favorite Links Shell Folder恢复丢失或删除最爱的连结Shell文件夹
- Change Group Ownership of Symbolic Links in Unix or Linux改变组所有权的符号链接在Unix或Linux
- Technorati Incoming Links Plugin for WordPress来Technorati链接插件的WordPress
- Amazon Context Links for Associates Affiliate Program亚马逊背景链接联营伙伴计划
- View and Retrieve Oracle Database Link Details查看和检索Oracle数据库的连接细节
- How to Add Jump Links in the Email如何添加跳转电子邮件中的链接
- Add NoFollow Relationship to WordPress Blogroll to Increase PageRank添加nofollow关系的WordPress网志串连,以增加的PageRank
- Launch and Open Links in New Window or Tab with _blank or _new as Target in HTML and Their Difference发射和打开链接在新窗口或标签_blank或_new为目标,在HTML和他们的差异
- How to Avoid, Bypass or Escape Google Sandbox如何避免,绕道或逃生的Google的Sandbox



















June 2nd, 2007 04:22 2007年6月2日4时22分
[...] Create Symbolic Links, Hard Links and Directory Junctions in Vista with MKLINK » My Digital Life: [...] [ … … ]创建符号链接,硬链接和目录路口,在Vista与mklink »我的数字生活: [ … … ]
June 23rd, 2008 09:36 2008年6月23日9时36分
I cannot figure out how to go to or switch to a symbolic link after it is created.我不能弄清楚如何去或切换到一个符号链接后,这是创建。 How do you do it?你怎么做呢? I can’t find instructions for this mentioned anywhere.我无法找到的指示,这在任何地方提及。
June 25th, 2008 06:32 2008年6月25日6时32分
Thanks for the post, but I don’t see the point of creating a symlink to a file.感谢后,但我不明白的出发点,创造一个符号链接到一个文件。 In your example, you created a symlink called “foo” pointing to notepad.exe, but what can you do to the file “foo”?在您的例子,您创建了一个符号连结所谓的“富”指出,记事本,但可以做什么,以档案“富” ? It’s not executable, even after I rename it to foo.exe.它不是可执行文件,甚至后,我将它重新命名为foo.exe 。
Thanks.谢谢。
July 22nd, 2008 17:39 2008年7月22日17时39分
you can’t execute symlinks, for that you need to make a shortcut the normal way.你无法执行的符号连接,你需要作一个捷径循正常途径。 A symlink is more usefull for ppl to read a certain file wich is in a folder they normaly can’t go to.一个符号链接是更有益的脂肪酶读某一个文件,该文件是在一个文件夹中,他们normaly不能去。 Or the same file is needed on 2 different folder locations, but you dont want to edit 2 seperate files all the time.或相同的档案,需要2个不同的文件夹的位置,但您不想要编辑的二单独的文件中的所有时间。