Windows 2008 Symbolic Links

While doing some research into Capistrano, I stumbled upon a term I hadn’t heard before, symbolic links. After doing some research it looks like this is a “new feature” for windows server 2008 (previously there were junction points, which are like symbolic links, but can only point to directories on the local machine).

I am wanting to use this feature to achieve what they do in capistrano (see Deployment Directory Structure).

[deploy here]/releases/20090210064623/(files here)
[deploy here]/current [symlink to 20090210064623]

With this in place it becomes very easy to install new versions of applications with out destroying the old installation, and if there is an error, in order to rollback all you have to do is change the symlink.

So here is how you make a symbolic link (if you know how to do it in the GUI let me know). Note: You have to be an admin to do this.

mklink /d .\fake .\real
symbolic link created for .\fake <<===>> .\real

Here is what it looks like on the command line with ‘dir’

02/09/2009  07:28 PM    <DIR>          real
02/09/2009  07:30 PM    <SYMLINKD>     fake [.\real]

and here is what it looks like in the explorer

There is no rmlink, you just rmdir or use explorer and delete it. I like that quite a bit, makes things simple. Now I just need to add this to either nant or nant-contrib.

-d

About Dru Sellers

Sr. Software Engineer at Dovetail Software.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • dvmil

    Welcome to 1978, Padawan. UNIX administrators have been enjoying symbolic links for decades.

  • Anonymous

    well i believe dropbox uses python (http://highscalability.com/blog/2011/3/14/6-lessons-from-dropbox-one-million-files-saved-every-15-minu.html) so there maybe something weird / interesting in how python reads those links.

  • http://www.seoprofessor.in/ T John

    This approach worked fine for me on my laptop. But I having a touch time on my Windows 2008 server. I was able to create the symbolic link as you suggested but DropBox does not recognize it on the Windows 2008 server. I think there is something different in the way Windows 2008 creates symbolic links.

  • http://lcxmmfjo.com/ Bbzwemtc

    ShIOi2

  • http://blog.troytuttle.com Troy Tuttle

    Hey, just wanted to second the Vista remark. I’ve used symbolic links on my home network for a while now. A nice usage is to share application data that is only meant for a single desktop. My wife and I like to keep our family photos in Google’s Picasa 3. We install the client to each laptop, create symbolic links to a network share for the Picasa data folder, and presto, you can get to the family photos from any machine in the house (just not at the same time).

    Oh, and for the GUI, I’m not on a Vista machine right now, but this path may work:
    Secpol.msc > Security Settings > Local Policies > User Rights Assignment > Create symbolic links

    Found it here: http://www.realtime-vista.com/command_line_tools/2007/09/vistas_symbolic_link_feature.htm

  • Josh

    For any PowerShell users out there, if you have PSCX installed, you can use New-SymLink to do this as well. One of the first things I do when I set up a new machine is delete Documents\Visual Studio 2005 and Documents\Visual Studio 2008, symlink them to Documents\Visual Studio (and hide the two symlinks using attrib +h /l)

  • Paco

    Nice feature. Can you create hard links to? Note to self: create an alias to ln -s in the windows shell.

  • Mark

    Symbolic links are NOT junctions. Symlinks can span network shares, junctions can only span hardrives on the same system.

    Windows Symbolic links are very similar to symlinks in UNIX based operating systems (a feature they have support since before I can remember). I am very glad MS realized the power that true symlinks offer.

  • http://ferventcoder.com Robz

    Sweet! I’ve heard of them as Junctions. You can do that right now even in XP. 😀

  • http://tunatoksoz.com Tuna Toksoz

    I’ve first seen it here
    http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html . It is very cool!

  • dru

    @Robert, thanks for the correction on the vista/2k8 thing. Yeah, I have been following Cap for awhile, but now we have it on windows. Was it lacking? For a long time? well, yeah but again we have it now so we can start rocking it out too!

    :)

    -d

  • http://www.sadev.co.za Robert MacLean

    Oh and most Linux file systems have had this for… um, well as long as I could remember.

  • http://www.sadev.co.za Robert MacLean

    It was actually a feature added to NTFS with Vista (http://en.wikipedia.org/wiki/NTFS_symbolic_link) as Win2k8 builds from the same code base it inherited the functionality.