I never knew you could do this, but it is pretty cool!
If you are a *nix power user, one of the things that has probably really frustrated you when you're in Windows is that Windows doesn't have symbolic links. The closest thing, Windows shortcuts, only work in Explorer: if you double click on a shortcut it will open its target, but you can't, for example, reference a shortcut in code and expect to get the contents of the target file when you do an fopen() on the shortcut path.
Well, if you're running NTFS 5.0 or better (Win 2k or better), there is a feature of the filesystem called a reparse point (also known as a junction point) that works very much like a unix symlink. They aren't wel documented by MS, but there are a handful of third-party utilities to work with them.
The easiest way I've found to create reparse points is with a free program from SysInternals (now part of MS) called junction. You can download junction from http://www.microsoft.com/technet/sys.../Junction.mspx.
Open the zip file and drop junction.exe to some folder in your path, then open a command prompt and type
Note: the syntax is backwards from the unix ln -s syntax, which would be ln -s /path /to/target link-nameCode:junction c:\link-name c:\path\to\target
Junction points can point to files or directories and they can span volumes. For example:
will create a junction point at c:\d-drive that will point to the root directory of your d: drive.Code:junction c:\d-drive d:\
Junctions appear just like file folders in Windows Explorer. They show up in command line "dir" output as <JUNCTION>, however.
WARNING: It appears that if you delete a junction point from the explorer you may delete the target as well (including all files in the directory if the target is a directory)! Therefore you should use a junction point management tool (like Sysinternals' junction) to remove junction points.
Here's a good reference on the topic: http://shell-shocked.org/article.php?id=284
Does anyone else know about this? I wish I had known about it sooner.


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks