OK, we take our last post back, Vista does have several exciting features to blog home about (and guys, for the last time, that comment’s what they call sarcasm!) one of which is the much requested “Symlinks” feature. It’s been in practically every other operating system for the past decade+ and is one of the most essential time-saving devices ever to be implemented. For those of you (Windows-dwelling creatures) that don’t know what a symlink is yet, here’s the Wikipedia definition.
Symlinks save tons of space by making files “pretend” to exist where they don’t, but even more importantly is the time they save by allowing you to create/reference a static filepath in all your programs – then have that “file” redirect to the real deal, no matter how often it changes. If you’re a web-dev kinda guy, think of it as mod_rewrite for your hard drive, without the PCRE libraries though… (come to think of it, the first OS to implement regex into symlinks has my vote!)
On Linux/BSD/Unix it’s called
CG@neosmart [~]# ln --help Usage: ln [OPTION]... TARGET [LINK_NAME] or: ln [OPTION]... TARGET... DIRECTORY or: ln [OPTION]... --target-directory=DIRECTORY TARGET...
but if you’re reading this, you probably already knew that; or at the very least you know where you can find the man page.
On Windows, it’s a very similar procedure. Microsoft had long promised that symlinks would ship with Vista, and every build we’ve been enthusiastically entering the ln command and hoping to get something other than the dreaded
'ln' is not recognized as an internal or external command, operable program or batch file.
But it turns out that it’s been in there for a while — just hiding under a different name. It’s called
mklink (in keeping with the
mkdir nomenclature obviously), and it works just as well.
C:\Users\Computer Guru.NEOSMART>mklink Creates a symbolic link. 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.
Now all Microsoft needs is to implement a mod_rewrite (or use one of the existing open-source implementations?) into IIS7 to suddenly kick-up the competition a notch…
Hat Tip: Thanks to Kristan Kenney!