文件文件夹映射junction和mklink,创建软硬链接

一、mklink

Vista系统开始提供的,创建软链接,硬链接的命令

语法:

Java代码   收藏代码
  1. D:\>mklink  
  2. 创建符号链接。  
  3.   
  4. MKLINK [[/D] | [/H] | [/J]] Link Target  
  5.   
  6.         /D      创建目录符号链接。默认为文件  
  7.                 符号链接。  
  8.         /H      创建硬链接,而不是符号链接。  
  9.         /J      创建目录联接。  
  10.         Link    指定新的符号链接名称。  
  11.         Target  指定新链接引用的路径  
  12.                 (相对或绝对)。  

/d:建立目录的符号链接 (symbolic link)
/j:建立目录的软链接(联接)(junction)
/h:建立文件的硬链接 (hard link)

D:\>mklink /d "D:\imagesd" "D:\images"  (可以指向远程目录)

       mklink /d d:\develop \\138.20.1.141\e$\develop

D:\>mklink /h "D:\imagesh.rar" "D:\images.rar"  (只能对文件操作,不能跨盘符)

D:\>mklink /j "D:\imagesj" "D:\images" (与junction.exe效果相同)

我一般使用/d

二、junction

junction.exe是一个命令行工具,

是微软提供的创建文件或文件夹软链接(联接)(junction)的工具,

可实现文件或文件夹的映射

Junction v1.06 下载
https://technet.microsoft.com/en-us/sysinternals/bb896768
https://download.sysinternals.com/files/Junction.zip

语法:

Java代码   收藏代码
  1. D:\>D:\junction.exe  
  2.   
  3. Junction v1.06 - Windows junction creator and reparse point viewer  
  4. Copyright (C) 2000-2010 Mark Russinovich  
  5. Sysinternals - www.sysinternals.com  
  6.   
  7. The first usage is for displaying reparse point information, the  
  8. second usage is for creating a junction point, and the last for  
  9. deleting a junction point:  
  10. usage: D:\junction.exe [-s] [-q] <file or directory>  
  11.        -q     Don't print error messages (quiet)  
  12.        -s     Recurse subdirectories  
  13.   
  14. usage: D:\junction.exe <junction directory> <junction target>  
  15.        example: junction d:\link c:\windows  
  16.   
  17. usage: D:\junction.exe -d <junction directory>  

创建联接

junction.exe -s 映射后地址 源地址

D:\junction.exe -s   D:\imagesjuction  D:\images

删除联接

junction.exe -d  映射后地址

D:\junction.exe -d   D:\imagesjuction

junction.exe 与 mklink /j 效果相同

Notethat Windows does not support junctions to directories on remote shares.

猜你喜欢

转载自www.cnblogs.com/duw76/p/9753625.html
今日推荐