Senin, 07 Februari 2011

How To Create A Soft Link In Windows

I ran into the situation where I needed to create a soft link (also known as symbolic link) on Windows 7, but after some searching on the web it turns out not to be a straightforward task. In Unix you simply do 'ln -s '. In Windows there are two ways of doing it:

1. Open a command prompt window and use mklink command. If you want to soft link to a directory you execute:

mklink /j C:\soft\link\name C:\path\to\target\directory
or
mklink /d C:\soft\link\name C:\path\to\target\directory

Note: The difference between /j and /d is /j creates a symbolic link while /d creates a hard link. Since you are linking to a directory you won't see any difference at all. Using the link created either way you'll be able to navigate to the destination folder and see its contents with no differences.

If you get an error saying you need admin privilege simply run the command prompt as the administrator as shown below:

How To Run Window

If you want to create a soft link to a file you do:

mklink C:\soft\link\name C:\path\to\target\file

2. Right click drag a target file from a Windows explorer window (namely a folder) to another explorer window and release. Then pick 'create a shortcut here' to create a shortcut. Then you simply double click on the shortcut icon to go the target. However if you open a command prompt window and try to navigate to the target via the shortcut through 'cd' you'll see an error. This makes this method useless in most situations.

Any question let me know!

0 komentar:

 
support by: infomediaku.com