Symlinks in Windows 7/Vista

Did you know you can create a symlink in Windows 7/Vista just like in Linux?  If you don't know what that is, imagine a directory somewhere which is actually displaying the contents of another directory, maybe on an entirely different hard drive.

The command needs to be run from the command line, and looks like this:

MKLINK [options] link target
Example:  MKLINK /J data "C:\Dropbox\MySQL Folder\data"

See this site for more details.

This feature is great because you can "trick" Windows into thinking any folder or file is actually somewhere else.  For example, let's say you have a game which always saves its files to "C:\game\saved".  Let's say you want that to be on another hard drive, or in Dropbox.  Well, with a symlink, that can be the case, and the game is none the wiser.

This feature is also great for server environments. For example, let's say you want to keep multiple installations of MySQL in sync, across multiple computers. Ex: between work and home. (I have this exact problem with projects run through xampp).

What I have learned to do is have the MySQL data directory in my Dropbox, and just create a symlink in my c:\xampp\mysql folder to the Dropbox folder, and presto!  Xampp doesn't know there's anything fishy going on with the servers, yet I can keep my MysQL databases in sync across multiple computers with the help of Dropbox.