1. 程式人生 > >什麽是符號鏈接與及怎麽創建

什麽是符號鏈接與及怎麽創建

符號 geek without folders esp mark target follow man

引用來自:https://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-symlinks-on-windows-or-linux/

Windows 10,8,7and Vista 都支持符號鏈接(symbolic link),即著名的symlinks-它指向你系統中的文件或者文件夾,你能創建他們使用這個命令行(command prompt ,admin priviledge)或者第三方工具叫做LINK SHELL Extension

EXCERPt:

What Are Symbolic Links?

Symbolic links are basically advanced shortcuts. Create a symbolic link to an individual file or folder, and that link will appear to be the same as the file or folder to Windows—even though it’s just a link pointing at the file or folder.

使用命令行怎麽創建符號鏈接:

Without any extra options, mklink creates a symbolic link to a file. The below command creates a symbolic, or “soft”, link at Link pointing to the file Target :

mklink Link Target

Use /D when you want to create a soft link pointing to a directory. like so:

mklink /D Link Target

Use /H when you want to create a hard link pointing to a file:

mklink /H Link Target

Use /J to create a hard link pointing to a directory, also known as a directory junction:

mklink /J Link Target

技術分享圖片

So, for example, if you wanted to create a hard link at C:\LinkToFolder that pointed to C:\Users\Name\OriginalFolder, you’d run the following command:

mklink /J C:\LinkToFolder C:\Users\Name\OriginalFolder

You’ll need to put quotation marks around paths with spaces. For example, if the folders are instead named C:\Link To Folder and C:\Users\Name\Original Folder, you’d use the following command instead:

mklink /J "C:\Link To Folder" "C:\Users\Name\Original Folder"

技術分享圖片

If you see the message “You do not have sufficient privilege to perform this operation.”, you need to launch the Command Prompt as Administrator before running the command.

還有第三方工具用法查看原文:

什麽是符號鏈接與及怎麽創建