We all know, and often use, that wonderful thing found in Unix systems - symbolic and hard links to files and directories. This is far from the same thing as the familiar shortcuts in Windows.
With the arrival of Windows Vista, we saw that somehow "Windows" could also create links, symbolic ones no less. But how? There's no corresponding option in Explorer.
The mklink command is used to create links in Windows Vista/7/2008:
> mklink <linkpath> <sourcepath>
Running mklink /? shows us help text stating that if we run the command without any additional parameters, a symbolic link to a file will be created; if we specify the /D parameter, a symbolic link to a directory will be created. To create a hard link to a file, we're offered the /H parameter, and for a Junction link, /J.
Example of creating a symbolic link to a directory:
> mklink /D C:\mydir\ThisIsLink D:\anotherdir\RealDir
ATTENTION! Hard links cannot be created for files located on a different partition (on a different hard drive).
All would be fine, but be very careful! Unlike Unix, this functionality in Windows has some buggy gotchas that can easily land you in trouble if you try to use it, for example, to fool MS SQL Server by slipping it a symbolic link instead of a real directory - it simply won't work.
PS. Some file managers, such as FAR or Total Commander with the NTFS Links plugin, have long been able to create links for Windows file systems.
Comments