文档章节

Mklink in Windows

雅各宾
 雅各宾
发布于 2014/08/13 21:19
字数 459
阅读 46
收藏 0

Mklink is a MS Windows command line utility that you can use to create symbolic links or symlinks and hard links in MS Windows. Mklink is a nice tool for troubleshooting file system problems. Mklink requires administrative privileges.

This page relates to explaining the difference between symbolic links and hard links on the Difference between symbolic link and hard link page.

First, let's introduce the mklink command. You can see it in the following print screen:

201204261733406074

It is pretty self-explanatory. Now, let's take a look at an example.

Mklink example

The print screen shown below demonstrates creating symbolic links, hard links, and shortcuts in MS Windows and how they differ.

Symbolic link:

  • Created as mklink link_name target_name

  • The icon next to the link is the same like that of a shortcut

  • Occupies zero space in the system

  • It is not a separate file in the file system

  • Interpreted at the operating system level

  • If the original file is deleted, the link is useless

  • Removing the original file does not remove the symbolic link

  • Removing the symbolic link does not remove the original file

Hard link:

  • Created as mklink /H link_name target_name

  • The space it occupies equals the size of the original file, but refers to the same object in the system (not a copy)

  • Interpreted at the operating system level

  • The icon next to the hard link is different from the other objects

  • Removing the original file does not remove the hard link

  • Removing the hard link does not remove the original file

  • If the original file is deleted, its content is still available through the hard link

  • Making a change to the hard link propagates all changes to the original file

Shortcut:

  • Created by right clicking the original file and selecting action from the drop down menu

  • A file in the system that is completely separate from the original file

  • Only those programs that know the concept of shortcuts understand them

  • If the original file is deleted, the link is useless

  • Removing the original file does not remove the shortcut

  • Removing the shortcut does not remove the original file

The print screen below shows these concepts.

20120426173418942

Linux uses a similar command called ln.

Mklink in Windows versus Ln in Linux

Note, the mklink syntax is a bit different from the Linux ln syntax (ln is used in Linux to create links).

Mklink: The name of the link is followed by the name of the target in the mklink command syntax. If you do not specify any flag, the mklink utility creates a symbolic link by default.

Ln: The name of the target is followed by the name of the link. If you want to create a symlink, you have to specifically include the -s flag.

© 著作权归作者所有

雅各宾
粉丝 9
博文 125
码字总数 53022
作品 0
深圳
技术主管
私信 提问
加载中

评论(1)

雅各宾
雅各宾 博主
有个臭翻译在这里:http://www.cnblogs.com/heqichang/archive/2012/04/26/2471774.html
如何使用mklink命令DIY自己的Windows Live Writer——安装、保存博文到D盘

Windows Live Writer是最好用的离线博客写作软件了,但是不足的地方在于强制安装在c盘,写好的博文也在C盘,下面介绍如何把这写移到D盘去。 举例: 先创建2个文件夹 D:Program FilesWindows...

丑矬穷
2013/05/17
83
0
更改chrome临时目录(可举一反三)

mklink命令是Windows 7/vista下的一个类似于linux下In的命令,其作用是在NTFS文件系统中创建文件或目录的链接(类似于桌面快捷方式)。用这个命令可以将系统文件转移到非系统盘,从而避免重装...

thiefqw
2014/04/14
0
0
Package Cache搬家

安装Visual Studio之后,系统(C)盘会多出一个目录C:ProgramDataPackage Cache,据说这个目录是不能删除的,但是可以转移到其他盘。 Google后发现2种方式: https://www.roelvanlisdonk.nl/201...

山里来的鱼
2016/10/08
296
0
关于golang.org/x包问题

由于谷歌被墙,跟谷歌相关的模块无法通过go get来下载 解决方法: 如果是Windows下,最后一条可以替换为mklink命令,或者直接拷贝文件夹修改一下名称即可。 原文地址:https://studygolang.c...

xunzaosiyecao
2017/11/15
0
0
mklink 1.0.5 发布,软链接 Gradle 构建时指定目录

mklink 1.0.5 发布了,mklink 作为一个 Gradle 插件,用于构建过程中对一些目录建立软链接.。 mklink 可以在 Gradle 执行构建任务时,将 Build 目录在恰当的时机建立在内存盘的软链接,达到加...

陌寻
08/19
686
0

没有更多内容

加载失败,请刷新页面

加载更多

SpringBoot 操作ActiveMQ

一、消息队列中间件介绍 消息队列中间件是分布式系统中重要的组件,主要解决应用耦合、异步消息、流量削锋等问题,实现高性能、高可用、可伸缩和最终一致性架构,是大型分布式系统不可缺少的...

zw965
28分钟前
4
0
本地化存储Storage

为什么会引入Storage(sessionStorage,localStorage,globalStorage) Web storage的目的是克服由cookie带来的限制,当数据需要严格控制在客户端上时,无须持续将数据发回服务器。主要是提供一...

五公里
37分钟前
8
0
Qt编写自定义控件57-直方波形图

一、前言 直方波形图控件非原创控件,控件大全中大概有20-30个控件非自己原创,而是参考了网上开源的代码,自己加以整理和完善,新增了插件的代码使得可以直接集成到QtDesigner或者QtCreator...

飞扬青云
37分钟前
4
0
或许你不知道的10条SQL技巧

这几天在写索引,想到一些有意思的TIPS,希望大家有收获。 一、一些常见的SQL实践 (1)负向条件查询不能使用索引 select * from order where status!=0 and stauts!=1 not in/not exists都不...

mskk
44分钟前
7
0
IntelliJ IDEA (Mac) 运行速度优化(JVM+localhost)

1.1. JVM 参数配置 打开 idea,菜单 –> help –> edit custom vm options,调整参数,重启即可。 具体调整参数: -Xms2g -Xmx2g -XX:ReservedCodeCacheSize=1024m -XX:+UseCompressedOops 1......

指尖Coding
52分钟前
10
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部