Jul 06 2012

Creating Symbolic Links in Windows 7

When I need to create a symbolic link (symlink) in Windows 7, I always forget how. Hopefully by sharing this information, I will be able to retain it.

To create a symbolic link in Windows 7, we can use the mklink command that comes with Windows 7.

Typically you want to create a symbolic link for a directory. This is accomplished by using the /D option.

To start you need to open a command (CMD) prompt as an administrator.

For our example, lets assume we have a folder called c:\development\php\myproject and we want to create a symbolic link in our Apache htdocs folder, c:\apache2\htdocs that points to our project. Using the symlink will allow us to make changes and not have to worry about copying them to the Apache folder.

To create the symlink, we will use the following command from the c:\apache2\htdocs folder:

mklink /D  


mklink /D myproject c:\development\php\myproject

There are other utilities out there that will do the same thing, but the mklink utility comes with Windows 7 and works.

Permanent link to this article: http://ericsilva.org/2012/07/06/creating-symbolic-links-in-windows-7/


    • Dan on Wednesday, July 11, 2012 at 2:22 pm

    I had no clue this concept existed in windows without software. This solves a problem I was having with setting up a jenkins build with a “remote” mercurial repository that I wanted to appear local. If I used UNC paths, jenkins would always clone fresh, which greatly increased build times. I couldn’t use a mapped drive since it’s not an interactive session. This fixed that problem. Thanks!

    • Guz Buzz on Saturday, August 22, 2015 at 10:09 pm

    yeay!! \^__^/

Leave a Reply