Windows Symbolic Links
DOOManiac
Worst. Critic. Ever. Join Date: 2002-04-17 Member: 462Members, NS1 Playtester
in Off-Topic
<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.
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
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
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.
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.
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.
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.....
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.
BURN!
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>.
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.
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-->
That's probably true. I generally turn my computer off when I sleep so it's only been on for about 12 hours now.
But really, thanks for the tip, DOOM. I can already see some uses for this.
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-->
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.