Create Symbolic Links, Hard Links and Directory Junctions in Vista with MKLINK創建符號鏈接,硬鏈接和目錄路口,在Vista與mklink
For Unix-like or Linux system users, symbolic link is a common feature in use almost daily.為Unix的一樣,或Linux系統的用戶,符號鏈接的一個共同特點是在使用中幾乎每天都有。 Symbolic link (aka soft link) or symlink as it often shortened to, is a special type of file or file-system object that serves as a reference or points to another file, UNC or directory, known as target.符號鏈接(又名軟鏈接)或符號連結,因為它往往縮短,是一種特殊類型的文件或文件系統的對象提供了一個參考或點到另一個文件,聯合國軍司令部或目錄,被稱為目標。 In Windows Vista, symlinks feature has been added to NTFS filesystem and can be created by using MKLINK command.在Windows Vista中,符號連接的功能已添加到NTFS的文件系統和可以創造出用mklink指揮。 In previous Windows operating system, the closer thing to symbolic links is NTFS junction point, or worse, Windows shell shortcut (.lnk) file.在以往的Windows作業系統,更密切的事,符號鏈接是NTFS交界點,或更糟的是, Windows Shell中的捷徑( 。 lnk )文件。
Symlink in Vista, unlike .lnk shortcut in desktop or Windows Explorer, allow user to access files within the symbolic link created itself via explorer, the console and etc. And symbolic link also differ from NTFS junction point which can only link to folders and volumes, in which symlinks can point to a file, a UNC, a folder or a volume, as well as able to span file systems.在Vista中的符號連接,不像。 lnk快捷方式在桌面或Windows檔案總管中,允許使用者存取檔案內的符號鏈接,創造本身通過Explorer中,控制台等和符號鏈接,也不同於NTFS的交界點,只能鏈接到的文件夾和卷,在這種符號鏈接可以指向一個文件,一個UNC ,一個文件夾或卷,以及能夠跨度檔案系統。
Symbolic link is useful when you have a lot of folders and files are scattered all over the directory tree, and you need to manage them from a single location.符號鏈接是有用的當您有很多的文件夾和文件,分散在各地的目錄樹,並且您需要管理,他們從一個單一的位置。 Another scenario is that you have a deep nested file that you want to access quickly instead of traverse through one branch by one branch.另一種情況是,你有深刻的巢式文件,您要訪問的快速而不是導線通過一科一科。 And furthermore, for programmer, symlink provides a static file path that can be point to a ever changing object without affecting the functionality of the program.此外,為程序員,符號連接提供了一個靜態的文件路徑,可以指向一個不斷變化的對象在不影響功能的程式。 In all these situation, symbolic links can be created at a convenient location which point to the ‘real’ objects.在所有這些情況下,象徵性的聯繫,才能創造一個方便的位置,這點'真正的'對象。
As mentioned, to create a symbolic link, use MKLINK command line tool.如上所述,創建一個符號鏈接,使用mklink命令行工具。 MKLINK can be used to create a hard link or directory junction too. mklink可以用來創建一個硬鏈接或目錄的交界處。 Hard link is essentially giving another name or label to the objects, while NTFS directory junction point is used to redirect the whole folder to another folder as if it’s the original folder itself.硬鏈接,基本上是給另一個名稱或標籤的對象,而NTFS目錄交界點是用來重定向整個文件夾到另一個文件夾,因為如果它的原始文件夾本身。 Junction point is used extensively in Vista to provide support for old directory structures for user profiles (ie Documents and Settings) to point to the new user folders located inside Users directory.交界點是廣泛使用在Vista中提供支持的舊目錄結構為用戶配置文件(即文件和設置)以指向新的用戶文件夾內的用戶目錄中。
Syntax and Options of MKLINK 語法和選擇mklink
MKLINK [[/D] | [/H] | [/J]] Link Target mklink [ / ] | [ /小時] | [ / j ]鏈接目標
/D - Creates a directory symbolic link. / -創建一個目錄的符號鏈接。 Default to file symbolic link.默認文件符號鏈接。
/H - Creates a hard link instead of a symbolic link. /小時-創建一個硬鏈接而不是一個符號鏈接。
/J - Creates a Directory Junction. / j -創建一個目錄交界處。
Link - Specifies the new symbolic link name.鏈接-指定新的符號鏈接的名字。
Target - Specifies the path (relative or absolute) that the new link refers to.目標-指定的路徑(相對或絕對)說,新的聯繫是指。
Examples and Usages of MKLINK 例子和用法mklink
Note: Only Administrators can use MKLINK to create symbolic links unless override by using secpol.msc, so you need to run Command Prompt with elevated privileges, or else you will get “You do not have sufficient privilege to perform this operation.” error.注意:只有管理員可以使用mklink創建符號鏈接,除非凌駕使用secpol.msc ,所以你需要運行命令提示符以提升的權限,否則,你會得到“您沒有足夠的權限執行此操作。 ”錯誤。
To create symbolic link called foo to reference to c:\Windows\System32\notepad.exe:創建符號鏈接名為foo參考到C : \的Windows \ system32 \記事本:
C:\test>mklink foo c:\Windows\System32\notepad.exe為C : \測試> mklink富為C : \的Windows \ system32 \記事本
You will see the following result:您會看到下面的結果:
symbolic link created for foo <<===>> c:\Windows\System32\notepad.exe象徵性的聯繫創造了富<<===>>為C : \的Windows \ system32 \記事本
If you type dir in commnd prompt, you will see the following listing:如果您鍵入dir在commnd提示符下,您會看到下面的名單:
Volume in drive C has no label.貨量在驅動器C並沒有標籤。
Volume Serial Number is 2211-7428卷序號是2211-7428Directory of C:\test目錄為C : \測試
04/14/2006 11:24 AM <DIR> . 2006年4月14日上午11時24分<dir> 。
04/14/2006 11:24 AM <DIR> .. 2006年4月14日上午11時24分<dir> ..
04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 2006年4月14日上午11時24分<symlink>富[為C : \的Windows \ system32 \記事本]
1 File(s) 0 bytes 1檔( ) 0字節
2 Dir(s) 69,238,722,560 bytes free二迪爾( ) 69,238,722,560字節免費
To create symbolic link to a folder, simply use /D switch:創建符號鏈接到一個文件夾,只需使用/ d開關:
C:\test>mklink /d bar c:\windows為C : \測試> mklink /酒吧為C : \的Windows
symbolic link created for bar <<===>> c:\windows符號鏈接,創造酒吧<<===>>為C : \的Windows
Results of dir command:結果dir命令:
Volume in drive C has no label.貨量在驅動器C並沒有標籤。
Volume Serial Number is 2211-7428卷序號是2211-7428Directory of C:\test目錄為C : \測試
04/14/2006 11:24 AM <DIR> . 2006年4月14日上午11時24分<dir> 。
04/14/2006 11:24 AM <DIR> .. 2006年4月14日上午11時24分<dir> ..
04/14/2006 11:24 AM <SYMLINKD> bar [c:\windows] 2006年4月14日上午11時24分<symlinkd>酒吧[為C : \的Windows ]
04/14/2006 11:24 AM <SYMLINK> foo [c:\Windows\system32\notepad.exe] 2006年4月14日上午11時24分<symlink>富[為C : \的Windows \ system32 \記事本]
1 File(s) 0 bytes 1檔( ) 0字節
3 Dir(s) 69,238,722,560 bytes free三迪爾( ) 69,238,722,560字節免費
MKLINK cannot use to delete symbolic link. mklink不能使用刪除符號鏈接。 To remove a symbolic link, simply delete them as if you’re removing a normal file.要刪除一個符號鏈接,只需刪除它們,因為如果您刪除一個正常的文件。 For example, to delete the foo symbolic link created above, enter the following command:例如,要刪除富象徵性的聯繫創造了上述情況,輸入以下命令:
C:\test>del foo為C : \測試>刪除富
To remove the bar symbolic link to a folder created above, use the following command:刪除酒吧符號鏈接到一個文件夾中創建以上,使用下列命令:
C:\test>rd bar為C : \測試>路酒吧
IMPORTANT : This is a machine translated page which is provided "as is" without warranty. 重要說明 :這是一個機器翻譯網頁是“按原樣”提供的擔保。 Machine translation may be difficult to understand.機器翻譯可能很難理解。 Please refer to請參閱 original English article原來的英語文章 whenever possible.只要有可能。
Share and contribute or get technical support and help at分享和貢獻,或取得技術的支持和幫助,在 My Digital Life Forums 我的數字生活論壇 . 。
Related Articles相關文章
- 10 New Executables and 20 Old Commands in Windows Vista 10個新的可執行文件和20歲的命令在Windows Vista
- Restore Missing or Deleted Favorite Links Shell Folder恢復丟失或刪除最愛的連結Shell文件夾
- Change Group Ownership of Symbolic Links in Unix or Linux改變組所有權的符號鏈接在Unix或Linux
- Technorati Incoming Links Plugin for WordPress來Technorati鏈接插件的WordPress
- Amazon Context Links for Associates Affiliate Program亞馬遜背景鏈接聯營夥伴計劃
- View and Retrieve Oracle Database Link Details查看和檢索Oracle數據庫的連接細節
- How to Add Jump Links in the Email如何添加跳轉電子郵件中的鏈接
- Add NoFollow Relationship to WordPress Blogroll to Increase PageRank添加nofollow關係的WordPress網志串連,以增加的PageRank
- Launch and Open Links in New Window or Tab with _blank or _new as Target in HTML and Their Difference發射和打開鏈接在新窗口或標籤_blank或_new為目標,在HTML和他們的差異
- How to Avoid, Bypass or Escape Google Sandbox如何避免,繞道或逃生的Google的Sandbox




























June 2nd, 2007 04:22 2007年6月2日4時22分
[...] Create Symbolic Links, Hard Links and Directory Junctions in Vista with MKLINK » My Digital Life: [...] [ … … ]創建符號鏈接,硬鏈接和目錄路口,在Vista與mklink »我的數字生活: [ … … ]
June 23rd, 2008 09:36 2008年6月23日9時36分
I cannot figure out how to go to or switch to a symbolic link after it is created.我不能弄清楚如何去或切換到一個符號鏈接後,這是創建。 How do you do it?你怎麼做呢? I can’t find instructions for this mentioned anywhere.我無法找到的指示,這在任何地方提及。
June 25th, 2008 06:32 2008年6月25日6時32分
Thanks for the post, but I don’t see the point of creating a symlink to a file.感謝後,但我不明白的出發點,創造一個符號鏈接到一個文件。 In your example, you created a symlink called “foo” pointing to notepad.exe, but what can you do to the file “foo”?在您的例子,您創建了一個符號連結所謂的“富”指出,記事本,但可以做什麼,以檔案“富” ? It’s not executable, even after I rename it to foo.exe.它不是可執行文件,甚至後,我將它重新命名為foo.exe 。
Thanks.謝謝。
July 22nd, 2008 17:39 2008年7月22日17時39分
you can’t execute symlinks, for that you need to make a shortcut the normal way.你無法執行的符號連接,你需要作一個捷徑循正常途徑。 A symlink is more usefull for ppl to read a certain file wich is in a folder they normaly can’t go to.一個符號鏈接是更有益的脂肪酶讀某一個文件,該文件是在一個文件夾中,他們normaly不能去。 Or the same file is needed on 2 different folder locations, but you dont want to edit 2 seperate files all the time.或相同的檔案,需要2個不同的文件夾的位置,但您不想要編輯的二單獨的文件中的所有時間。