Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Windows Vista added the ability to create symbolic links to files and directories. How do I create a symbolic link and what are the current consumer and server versions of Windows that support it?

share|improve this question
5  
Can someone highlight the differences between a symbolic link and a shortcut? –  tomjedrz May 12 '09 at 2:46
    
@tomjedrz: if you are using shortcut, any APIs to open that shortcut will open a text file that contains the path to the target file/folder. if you are using links, any APIs to open that link will open the target file/folder. –  afriza Feb 17 '12 at 3:55
1  
Contrary to what all people have said, I confirm that it is possible to use symbolic links in Windows XP. (I use it to install Picasa database on VM shared folder). Just take a look at schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html and navigate to section "Symbolic links for Windows XP". HTH –  Adam Ryczkowski Oct 24 '12 at 6:48
add comment

8 Answers

up vote 69 down vote accepted

You can create a symbolic link with the command line utility mklink.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

Symbolic links are supported on NTFS file systems only and are available in Windows Vista, Windows Server 2008 and Windows 7. Future Windows operating systems are likely to continue support for this command.

You can read further information about this new feature on Microsoft TechNet, Junfeng Zhang's blog or howtogeek.com.

share|improve this answer
    
Would be nice to add David's Technet url to your entry for completeness. –  Michael Pryor May 11 '09 at 18:22
    
site note, what is a juntion (/J option) ? –  Roy Rico Sep 22 '09 at 21:06
    
A Directory Junction a type of directory symbolic link. support.microsoft.com/?kbid=205524 –  Lara Dougan Dec 7 '09 at 8:09
    
NTFS has been supporting links (with various names) since Windows 2000, but they were only used internally, most notably in the SYSVOL domain shares; some utilities were available for managing them, but were not built-in; Vista introduced the MKLINK tool and the extensive usage of links on default Windows installations. –  Massimo May 9 '11 at 14:13
2  
Would be nice to mention fsutil from @sascha's answer below to provide a solution for Windows Server 2003. –  Phrogz Jul 19 '11 at 22:13
show 1 more comment

On Windows XP you can use fsutil (built into the OS) to create a hardlink

 fsutil hardlink create c:\foo.txt c:\bar.txt

Keep in mind fsutil will only work if both are on same drive

share|improve this answer
2  
Good answer. I'm on WinXP / Win2003 and needed mklink, but this solved my issue for me. I usually use junction.exe from sysinternals, but that only handles directories and in this case I needed a file link –  Sebastian Mar 16 '11 at 10:37
add comment

Use mklink or junction from Sysinternals (Microsoft). I believe mklink will work in Windows 2000 and above, but I cannot find any hard documentation on that. junction is for Windows 2000 and above.

share|improve this answer
    
The command mklink is Vista and Server 2008 and up only, as I pointed out above. –  user1797 May 11 '09 at 18:12
add comment

One small thing, if you are using Powershell, mklink does not work directly, run it like this:

PS C:\d\eclipseInstalls> cmd /k mklink /D antRunner 3.4.2
symbolic link created for antRunner <<===>> 3.4.2
share|improve this answer
    
That should be /c, not /k, otherwise cmd.exe won't exit. –  dangph Mar 15 '10 at 7:04
add comment

Didn't see this in any of the answers, but linkd.exe (in the Windows 2003 Resource kit here) allows you to create junctions, which pretty much function as a soft/hard link does in Linux. Junctions are available from Windows 2000 and up, so just copy linkd.exe to the target system and it should work.

share|improve this answer
1  
Note that ` /linkd` is only for directories, not files. –  Phrogz Jul 19 '11 at 22:11
add comment

If you are still on old Windows, like XP, 2000, 2003, etc., try NTFS Link.

I use it a lot. You get a shell link right click menu option to create a junction point. Excellent stuff.

share|improve this answer
    
This worked great for me on Windows 2003 for creating a symbolic link to a folder on another drive. Thanks! –  Phil Nov 13 '11 at 18:54
    
Comment from anonymous user, originally edited into the answer: "Note: For XP to work, it has to be using an NTFS partition, not FAT or FAT32. See aumha.org/win5/a/ntfscvt.php for steps on how to convert to NTFS." –  squillman Aug 17 '12 at 19:32
add comment

See TechNet entry. I believe it is a Vista/Server 2008 and up feature.

share|improve this answer
    
Cool, never known about this feature before, thanks for the link, could be so much usefull!!! –  Marc-Andre R. May 11 '09 at 18:11
add comment

To make sure your links work you might want to check the configuration of your server. Links can be made but unless you use the symlinkevaluation setting in the following command your links might not work.

fsutil behavior set SymlinkEvaluation L2L:1 R2R:1 L2R:1 R2L:1

See also http://technet.microsoft.com/en-us/library/cc754077%28v=ws.10%29.aspx. By default only the local options are activated.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.