NTFS 符号链接又称“符号链接”,是 NTFS 文件系统中指向文件系统中的另一个对象的一类对象,被指向的对象叫做“目标”。
mklink 是 Windows 下用于创建符号链接的工具,存在于 Windows Vista 及以后版本的 Windows 操作系统中。
使用方式:
mklink /J "C:\Users\用户名\Documents" "D:\Document"
像上面这样,可以把C盘中我的文档文件夹放到别的磁盘,节省C盘空间。(以前觉得360等管理工具的这个迁移我的文档功能很厉害,没想到也就just so so。)
需要注意的是windows及其下面的system32目录等是不支持迁移的,因为符号连接在系统启动的时候是不工作的。
另外users、Program Files 、ProgramData等文件夹也不建议迁移,因为可能影响windows update和其他windows组件的安装和升级。
下面详细说说这个工具的其他用法。
MKLINK [[/D] | [/H] | [/J]] Link Target /D 创建目录符号链接。默认为文件符号链接。 /H 创建硬链接而非符号链接。 /J 创建目录联接。 Link 指定新的符号链接名称。 Target 指定新链接引用的路径(相对或绝对)。
上面的表格顺序,从上到下的行为从越来越像快捷方式到越来越像两个独立的文件夹 。
不带参数时就是普通的文件快捷方式创建方法。
目录符号链接(/D)与目录连接点(/J)
目录符号链接(/D)与目录连接点(/J)非常相似,都是用于文件夹。
目录符号链接允许 Target 使用相对路径和绝对路径,当使用相对路径时创建目录符号链接之后,如果移动了符号链接文件,操作系统将无法再找到原来的目标。
目录连接点只允许 Target 使用绝对路径,当创建目录连接点时,如果传入的参数是相对路径,mklink 命令会自动将相对路径补全为绝对路径。
当目录符号链接使用绝对路径时,其行为与目录连接点几乎一致,只有以下几点区别。
1.目录符号链接可以指定 SMB 远程网络中的路径,而目录连接点不可以。
2.某些系统API的访问效果不同:如用使用 FileDialog 打开 /D 生成的目录,地址栏会跳到源目录位置;而 /J 生成的目录不会。用 FolderDialog 打开,两者相同。
3.两者生成目录的系统权限不一样: /J 生成的目录不需要管理员权限。
4./D 生成的目录在系统初始化时不可用。
综合来看,如果要链接SMB远程网络的路径就使用/D,其他情况下尽量使用/J。
文件硬链接(/H)
/H的硬链接其实相当于带有关联的文件副本,显示是两个独立的文件而不是带箭头的快捷方式,修改一方(包括权限的修改),另一个自动同步,但删除一个另一个依然存在。
使用同名文件替换一方,另一方也会被替换。也就是说,两个文件的地位是相等的。
windows会自动维护硬链接,因此可以移动到别的文件夹依然生效。
另外因为硬链接不占用磁盘空间,硬链接只能存在同一个分区或者卷中。
注意事项
1.使用 mklink 创建符号链接的时候,操作系统并不会检查目标是否存在。所以可以创建指向不存在的目标的符号链接。
2.注意尽可能不要使用符号链接嵌套。也就是在一个文件夹 A 中创建一个符号链接指向 A 自己。这会产生一个无限循环递归的文件系统(Windows 下限制了路径长度最大为 128 个字节),会使大部分应用程序在遍历文件夹目录的时候产生循环错误(因为对应用程序来说,文件夹的符号链接与普通的文件夹是完全一样的)。
你从一个地方跑到另一个地方,
但你还是你。
你没法从自己的身体里面逃出去。
《太阳照常升起》
——海明威
评论
147303 822289i just didnt require a kindle at very first, but when receiving 1 for christmas im utterly converted. It supply genuine advantages over a book, and makes it such a lot additional convenient. i may undoubtedly advocate this item: 435854
F*ckin¦ awesome things here. I¦m very satisfied to see your post. Thank you a lot and i’m looking ahead to touch you. Will you please drop me a e-mail?
https://komputer-sos.es/ratones/67627-logitech-910-005398-wireless-mouse-m235-raton-ambidextro-rf-inalambrico-optico-1000-dpi-5099206079458.html
Hello. excellent job. I did not anticipate this. This is a remarkable story. Thanks!
https://www.upiinformatica.com/pantallas-para-pc/353550-lg-27gr95qe-b-AEu-27gr95qe-b-pantalla-para-pc-67-3-cm-26-5-2560-x-1440-pixeles-quad-hd-oled-n-8806098788835.html
224245 129870There is noticeably a bundle to know about this. I assume you made certain good points in capabilities also. 352254
I got what you intend, regards for posting.Woh I am pleased to find this website through google.
https://www.tdsky.com/hire-a-hacker-for-instagram/
I have learn some excellent stuff here. Certainly worth bookmarking for revisiting. I surprise how much attempt you place to make this type of great informative site.
https://youtu.be/WdflOkfiI2c
I went over this site and I think you have a lot of fantastic information, saved to favorites (:.
https://youtu.be/209DcrYTa5o
Regards for all your efforts that you have put in this. very interesting information.
https://youtu.be/lJRxW4qrVfw
Thank you for the good writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! By the way, how can we communicate?
https://youtu.be/BanYFY6l55c
What Is Exactly ZenCortex? ZenCortex is an optimal hearing function support
https://youtu.be/zn3lvvumcNw
I have been exploring for a bit for any high-quality articles or blog posts on this kind of space . Exploring in Yahoo I ultimately stumbled upon this site. Reading this information So i’m satisfied to exhibit that I have an incredibly good uncanny feeling I discovered just what I needed. I so much undoubtedly will make certain to don’t forget this site and provides it a glance on a continuing basis.
https://youtu.be/Rxf5g12QvmY
I like this blog so much, saved to fav.
https://youtu.be/ds-A1POGGQs
938329 544898I like this internet site so a lot, bookmarked . 231255