跳到主要内容

链接

Windows 中的硬链接、软链接、符号链接、快捷方式

定义

让一个文件可以拥有多个访问路径
这个是操作系统概念,不过暂时把它放在Batch里面

mklink可以创建硬链接/软链接/符号链接

种类

快捷方式

shortcut

不可用命令行创建,只能通过右键或者调用COM接口(IShellLink)创建

注意:快捷方式本质是lnk类型的文件,无法通过Path重定向

硬链接

hard link

软链接

junction point / soft link / reparse point

符号链接

区别

类型链接到文件链接到目录跨越磁盘分区指向不存在的目标指向相对目录删除
快捷方式 shortcutdel file
硬链接 hard linkdel file
软链接 junction point/softlink/reparsepointrd folder
符号链接rd folder or del file