Windows Symbolic Links

DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
<div class="IPBDescription">a nifty tip for all you guys</div>Some of you guys who use linux are used to having symbolic links and have probably wished for similar functionality on Windows. Well now you can have all you want.

For those who don't know what a symbolic link (also called JUNCTIONS on Windows) is, its kinda like a shortcut, except the OS sees the shortened path as the actual path to the data, and not just a shortcut. Think of it as a wormhole to a directory in your hard drive. :P

An example perhaps makes it easiest to see:
STEAM is buried several layers deep in the directory tree:
<span style='font-family:Courier'>C:\Program Files\Steam\SteamApps\</span>

As you might imagine, I have to go to this directory quite frequently. Its a bit of a hassle to navigate that deep into the directory tree on a regular basis, so I set up a symbolic link in my <span style='font-family:Courier'>C:\Espionage</span> directory to point at STEAM's 'SteamApps' folder:
<span style='font-family:Courier'>C:\Espionage\SteamApps.sym\</span>

<i>Note: i give it a .sym extension so I can easily remember its a symbolic link. This is not required, but its a good idea so you don't delete it because you'll end up deleting your real SteamApps dir too!</i>

<a href='http://shell-shocked.org/article.php?id=284' target='_blank'>This page</a> gives a more detailed explanation if you're interested.

A picture is worth 1.21 gigawatts, so here are a few:

The original directory tree (<span style='font-family:Courier'>C:\Program Files\Steam\SteamApps\</span>)
<img src='http://www.doomaniac.com/stuff/Symbolic%20Links/longtree.jpg' border='0' alt='user posted image' />

The symbolic link (aka Junction) in action (<span style='font-family:Courier'>C:\Espionage\SteamApps.sym\</span>)
<img src='http://www.doomaniac.com/stuff/Symbolic%20Links/shorttree.jpg' border='0' alt='user posted image' />

As far as windows is concerned, these two directories are identical:
<img src='http://www.doomaniac.com/stuff/Symbolic%20Links/orig_prop.jpg' border='0' alt='user posted image' /> <img src='http://www.doomaniac.com/stuff/Symbolic%20Links/link_prop.jpg' border='0' alt='user posted image' />

The only way to tell that it's a symbolic link (aka Junction) is to look with the command prompt:
<img src='http://www.doomaniac.com/stuff/Symbolic%20Links/cmd.jpg' border='0' alt='user posted image' />

How is this possible? It turns out the functionality is built right into Windows, and has been ever since Win2000. It was just very poorly documented (even for Microsoft) and was generally looked upon as a bastard child. It was deemed too complex of a feature for the masses, and was greatly ignored. In fact, there isn't even a built in tool anywhere in windows to create a symbolic link. Third party tools had to be written to create and manage these things. That's why their existance is just now getting popular.

Okay, so now you know what a symbolic link is, and you want your own. Before we start on how to make your own symbolic links, first you should know a few things:

- Symbolic Links only work on NTFS 5 partitions. If you're using FAT32, you're out of luck.
- A symbolic link must be created from an empty folder (some tools take care of this for you)
- Symbolic Links do not work across network drives. :(
- *DO NOT DELETE A SYMBOLIC LINK WITHOUT THE USE OF THE UTILITY. YOU WILL DELETE ALL THE FILES THE LINK POINTS TO AS WELL!*
- *BE VERY CAREFUL NOT TO MAKE A CIRCULAR LINK*

(A circular link is when you have a symbolic link in directory A that points to directory B, and another link in directory B that points to directory A. This will cause a virus scanner to never finish, because it keeps going in a loop deeper and deeper into the directory tree.)

Okay, now that's out of the way. NOW what's left?

1) Download & install <a href='http://www.rekenwonder.com/linkmagic.htm' target='_blank'>Junction Link Magic</a>. It's a pretty fool-proof tool, so you don't have to worry about doing anything wrong.
2) When you run it it will scan your drive for existing junctions. You can click cancel for this process the first time you load it as your drive has no junctions.
3) Click 'Create'. This will open a window with 2 tree views. The one on the left is where your symbolic link (aka junction) will be. The one on the right is the directory it should point to. Click the 'Create button and you're done!

Remember, if you ever want to get rid of the symbolic link, do not just delete it through Windows. Load up this tool, let it scan your hard drives, and then use the Remove button to have it safely remove the junction for you.

Again, if you have any questions about the process its recommended you read <a href='http://shell-shocked.org/article.php?id=284' target='_blank'>this document</a>. It's a lot more technical than my little tutorial, and it also discusses a similar and easy-to-mix-up topic known as hard links, but it will give you a better idea of exactly how its working if you're still not sure from my post.

Comments

  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    That seems like a lot more trouble than "ln -s /path/to/whatever /path/to/symlink"
  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    edited April 2005
    Another example of where this could be useful:

    Say you go to your NS directory a lot.
    Its in <span style='font-family:Courier'>C:\Program Files\Valve\Steam\SteamApps\<email>\Half-Life\ns\</span>
    You can make a symlink to have it simply be:
    <span style='font-family:Courier'>C:\ns.sym\</span>


    Caboose: Yeah yeah. It is a bit more cumbersome. But really the actual process of doing it isn't bad at all, its just the knowledge you have to read up on before hand. But shush it Linux boy. You can't play HL2 or KOTOR2 on Gentoo. Not w/o some half-assed windows emulation anyway. :P
  • Sub_zer0Sub_zer0 Join Date: 2004-05-09 Member: 28569Members
    I just go to properties and "find shortcut" and go up from there
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    COMPATABILITY LAYER! not emulation! <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif' /><!--endemo-->
  • esunaesuna Rock Bottom Join Date: 2003-04-03 Member: 15175Members, Constellation
    To be honest, what's wrong with shortcuts?

    Not only do they not have any risk of deleting content, but they're easily set up through Windows itself without a third-party application.

    Infact, i don't even use that, in my explorer windows, my favourites list is populated by regulaly used local folders, so from anywhere on the HDD i can get to one of them, and that's what i used when jumping back and forth with my mod source directory and the SteamApps folder.
  • Umbraed_MonkeyUmbraed_Monkey Join Date: 2002-11-25 Member: 9922Members
    edited April 2005
    omg <3


    My *nix skills is a bit rusty, but isnt this actually called hard link? (ln without the -s?)
    edit: nvm...its not really a symlink, but not yet a hard link either.
  • AlignAlign Remain Calm Join Date: 2002-11-02 Member: 5216Forum Moderators, Constellation
    Use this for what exactly?
  • Invader_ScootInvader_Scoot Join Date: 2003-10-13 Member: 21669Members, Constellation, Reinforced - Shadow
    <!--QuoteBegin-esuna+Apr 10 2005, 02:29 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (esuna @ Apr 10 2005, 02:29 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> To be honest, what's wrong with shortcuts?

    Not only do they not have any risk of deleting content, but they're easily set up through Windows itself without a third-party application.

    Infact, i don't even use that, in my explorer windows, my favourites list is populated by regulaly used local folders, so from anywhere on the HDD i can get to one of them, and that's what i used when jumping back and forth with my mod source directory and the SteamApps folder. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    Yeah, this doesn't seem to be worth it, shortcuts do the same thing.
  • VenmochVenmoch Join Date: 2002-08-07 Member: 1093Members
    edited April 2005
    <!--QuoteBegin-Caboose+Apr 10 2005, 08:22 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Caboose @ Apr 10 2005, 08:22 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> That seems like a lot more trouble than "ln -s /path/to/whatever /path/to/symlink" <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Uh because that would require installing Linux?

    Which is something I really really really (did I say really?) want to do.

    Because if something goes wrong in Windows (Which personally I like) I could go somewhere like this very forum and ask for help. HOWEVER, if I want help for Linux I've got to go to a forum usually full of condesending "Pros" who laugh at my distro choice because it'll either be nub or insult my ability to use a PC. (I remember being told the best way to get help while using linux is to go to a forum or chatroom and say "OMG! I can do this thing like I can in Windows! Linux sucks!" Which gets all the nerds going "No no it works this way Linux > Windows Woo!")

    So yeah Linux will only start getting big when its users become less condesending. Oh and they drop the holier than thou attitude. Oh and they get some good games (DOOM 3 and UT2004 are not good games! However having Darwinia gives Linux some kudos.) Oh and they get better user support. Oh and they stop having a wide choice of Distros that don't confuse the consumer and better driver support and.....
  • esunaesuna Rock Bottom Join Date: 2003-04-03 Member: 15175Members, Constellation
    <!--QuoteBegin-Venmoch+Apr 10 2005, 08:49 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Venmoch @ Apr 10 2005, 08:49 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin-Caboose+Apr 10 2005, 08:22 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Caboose @ Apr 10 2005, 08:22 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> That seems like a lot more trouble than "ln -s /path/to/whatever /path/to/symlink" <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Uh because that would require installing Linux?

    Which is something I really really really (did I say really?) want to do.

    Because if something goes wrong in Windows (Which personally I like) I could go somewhere like this very forum and ask for help. HOWEVER, if I want help for Linux I've got to go to a forum usually full of condesending "Pros" who laugh at my distro choice because it'll either be nub or insult my ability to use a PC. (I remember being told the best way to get help while using linux is to go to a forum or chatroom and say "OMG! I can do this thing like I can in Windows! Linux sucks!" Which gets all the nerds going "No no it works this way Linux > Windows Woo!")

    So yeah Linux will only start getting big when its users become less condesending. Oh and they drop the holier than thou attitude. Oh and they get some good games (DOOM 3 and UT2004 are not good games! However having Darwinia gives Linux some kudos.) Oh and they get better user support. Oh and they stop having a wide choice of Distros that don't confuse the consumer and better driver support and..... <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    Linux is just there for people to "stick it" to "the man."

    It's userbase is a bunch of wankers, it's useless as a platform as a gamer and it's so user-unfriendly it makes the entire process of bothering to install it and set it up pointless.

    Do yourself a favour, stick to Windows.
  • Omega_DeathOmega_Death Sith apprentice to a box of Cereal Join Date: 2003-08-06 Member: 19042Members
    <!--QuoteBegin-DOOManiac+Apr 10 2005, 03:23 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (DOOManiac @ Apr 10 2005, 03:23 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> But shush it Linux boy. You can't play HL2 or KOTOR2 on Gentoo. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    BURN!
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited April 2005
    <!--QuoteBegin-esuna+Apr 10 2005, 03:26 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (esuna @ Apr 10 2005, 03:26 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> It's userbase is a bunch of wankers, it's useless as a platform as a gamer and it's so user-unfriendly it makes the entire process of bothering to install it and set it up pointless.

    Do yourself a favour, stick to Windows. <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    While the userbase is a bunch of "wankers", it's not "useless" as you put it.

    Actually, for gaming, Linux is great. Every OpenGL game I've played in Linux that I've also played in Windows just runs better. Linux has far better memory managment that is very benificial to games, obviously.

    Currently in Linux I'm running Firefox, AmaroK (Audio player), X-Chat and 2 terminals, with smb4k in the bacground (samba frontend to connect to my Windows network) and I have 304Mb of RAM free of 512Mb. Wheras if I were running similar programs in Windows (Firefox, Winamp, 2 cmd windows and X-Chat) I'd have maybe 180Mb free If I'm lucky.

    I do however use Windows on occation to play DirectX games, but most of the time I find myself using Linux, be that for browsing the web, doing homework, playing Tribes 2, Americas Army, UT2k4, Q3, ET, etc.

    Both OS's have benifits, and I don't really like one over the other for what I use them for. I'm not that much of a fanboy <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile-fix.gif' border='0' style='vertical-align:middle' alt='smile-fix.gif' /><!--endemo-->

    I really don't care about how user friendly you think it is either, I don't fint it intimidating in the least bit, neither does <a href='http://www.reallylinux.com/docs/gran3.shtml' target='_blank'>granny</a>.
  • CyndaneCyndane Join Date: 2003-11-15 Member: 22913Members
    *Stabs the ebil peguin*

    In other words, it look interesting doomey, but I don't think I'm going to be able to use it since I don't go to my HDD directories that much. At least via Explorer.
  • im_lostim_lost TWG Rule Guru Join Date: 2003-04-26 Member: 15861Members
    This might be useful for getting to IRC logs, if I didn't have them in three different places.
  • DubbilexDubbilex Chump Join Date: 2002-11-24 Member: 9799Members
    <!--QuoteBegin-Caboose+Apr 10 2005, 05:13 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Caboose @ Apr 10 2005, 05:13 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->Currently in Linux I'm running Firefox, AmaroK (Audio player), X-Chat and 2 terminals, with smb4k in the bacground (samba frontend to connect to my Windows network) and I have 304Mb of RAM free of 512Mb. Wheras if I were running similar programs in Windows (Firefox, Winamp, 2 cmd windows and X-Chat) I'd have maybe 180Mb free If I'm lucky.<!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    The only thing on that last list that I am not running are the command windows. And unless they take about 130 mgabytes of memory to run (on top of the ~200 that my 34 existing processes are already using), that last bit just might be an overstatement. In summation, right now I have 300 megabytes free and I also run 512.

    Which, in hindsight makes me wonder just why the hell Firefox takes 50 megabytes of my memory to run <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad-fix.gif' border='0' style='vertical-align:middle' alt='sad-fix.gif' /><!--endemo-->
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    But I'm talking of running for a long amount of time. generally, as Time goes on when I'm on windows, more memory is consumed. It's pretty constant whilst in Linux.
  • DubbilexDubbilex Chump Join Date: 2002-11-24 Member: 9799Members
    <!--QuoteBegin-Caboose+Apr 10 2005, 06:13 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Caboose @ Apr 10 2005, 06:13 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> But I'm talking of running for a long amount of time. generally, as Time goes on when I'm on windows, more memory is consumed. It's pretty constant whilst in Linux. <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    That's probably true. I generally turn my computer off when I sleep so it's only been on for about 12 hours now.
  • DOOManiacDOOManiac Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
    Well Caboose, thanks for single handedly turning my thread from a windows tips thread into a linux vs windows crusade...
  • PulsePulse To create, to create and escape. Join Date: 2002-08-29 Member: 1248Members, Constellation
    Jiggawatt? What the hell is a jiggawatt?

    But really, thanks for the tip, DOOM. I can already see some uses for this.
  • panda_de_malheureuxpanda_de_malheureux Join Date: 2003-12-26 Member: 24775Members
    Isn't this sort of like mapping a network drive but to your own computer? I suppose a limitation is that it has to be a drive not a folder/symbolic link, but when everything is in 'my computer' it's nice and clean.
  • MerkabaMerkaba Digital Harmony Join Date: 2002-01-24 Member: 22Members, Retired Developer, NS1 Playtester
    Hooray for DOOManiac! I had been wondering if this sort of thing were possible for ages, after getting fed up having to plough through 8 directories to find the one I want.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    <!--QuoteBegin-DOOManiac+Apr 10 2005, 10:42 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (DOOManiac @ Apr 10 2005, 10:42 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Well Caboose, thanks for single handedly turning my thread from a windows tips thread into a linux vs windows crusade... <!--QuoteEnd--> </td></tr></table><div class='postcolor'> <!--QuoteEEnd-->
    Sorry <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad-fix.gif' border='0' style='vertical-align:middle' alt='sad-fix.gif' /><!--endemo-->
  • Cold_NiTeCold_NiTe Join Date: 2003-09-15 Member: 20875Members
    edited April 2005
    <!--QuoteBegin-Caboose+Apr 11 2005, 12:09 AM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Caboose @ Apr 11 2005, 12:09 AM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> <!--QuoteBegin-DOOManiac+Apr 10 2005, 10:42 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (DOOManiac @ Apr 10 2005, 10:42 PM)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin--> Well Caboose, thanks for single handedly turning my thread from a windows tips thread into a linux vs windows crusade... <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Sorry <!--emo&:(--><img src='http://www.unknownworlds.com/forums/html/emoticons/sad-fix.gif' border='0' style='vertical-align:middle' alt='sad-fix.gif' /><!--endemo--> <!--QuoteEnd--></td></tr></table><div class='postcolor'><!--QuoteEEnd-->
    Personally I'd expect no less from someone with a penguin avatar and a previous user of a GENTOO signature.

    -------------
    As for these symbolic links, I'm curious if there is a short and simple way to set them up. It's late and my thoughts are a little too scattered to make sense of that guide. I'll probably try back tomorrow and realize I skipped every other word or something but hey that's how things are I guess.
Sign In or Register to comment.