Quick tip: Symbolic links in Windows

It’s already 12:28 AM. I really need to make this quick, though I’m not really sleepy.

Symbolic links as I see it, is merely a shortcut to a certain directory that you point out. The only difference is that its not actually just pointing out to another directory. Just like when you create a shortcut in windows.

Because when you click on a shortcut, it leads you to the directory which you specified when you created the shortcut.

Here’s an example. We are in drive c, the animeMusic folder is a symbolic link. While the dls is a shortcut. Examine what happens with the address on the next screenshot

image

You will see here that if I click on the folder dls. I will be brought to the actual directory that I specified in the shortcut.

image

Examine the shortcut properties:

image

This time I click on the folder animemusic. See what happens to the address:

image

The actual location of that folder is in a different drive:

image

This is great because now we can either refer to the symbolic link or the original directory if we need to.

We can use this on our web development projects when linking files:

require_once(‘c:symboliclinksomefile.php’);

Might be easier than typing the whole path in case the path that you are linking looks something like this:

d:extrasuperduperlongheavyweightfolderpathfilename.php

Well that’s a little bit exaggerated on my part but I think you get what I’m talking about here.

 

How?

Yeah, I almost forgot that I still haven’t showed you how, and this quick tip really gets longer and longer as I spout more useless words.

To create a symlink, just open up your command line and follow this general format:

mklink D  NEW_PATH BASE_PATH

D is a parameter for the mklink command which tells that a symbolic link directory must be created.

NEW_PATH is an unexisting path.

BASE_PATH is the path that you want to link to your newly created path.

Here’s an example:

mklink D C:UsersAizenMusicAnimeMusic  X:DropboxMusic

Yeah, that’s pretty much the command that I used to create the AnimeMusic symbolic link above.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s