- Forums
- Windows Hosting
- Easy Tutorial - How To Make A Symbolic Link In Windows 7
this page will teach you step by step on how you create a symbolic link in windows seven very easy instruction you can follow [647], Last Updated: Sat May 18, 2024
mel
Sun Jun 26, 2011
2 Comments
3897 Visits
if you are familiar with linux systems, you might be familiar with creating symbolic links in linux. now my question is how do you create symbolic links in windows? i have windows 7 machine so i am going to teach you how.
first go to Start > All Programs > Accessories > Command Prompt
right-click on Command Prompt and select Run as Administrator
once the DOS command prompt opens enter the
mklink utility
Syntax: MKLINK Link Target
DOS Command:
cd C:\Windows\system32\
DOS Command:
mklink
you will see output:
C:\Windows\System32>mklink
Creates a symbolic link.
MKLINK [[/D] | [/H] | [/J]] Link Target
/D Creates a directory symbolic link. Default is a file
symbolic link.
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
as you can see the utility shows you the correct syntax to use to create a symbolic link
a real world example: lets say have a program called apachefriends in the C:\apachefriends
then i got a new hard drive and the letter for that hard drive is D:
so i want to make sure that when i open
C:\apachefriends im actually opening the files i moved to
D:\apachefriends
you need to open the DOS command with administrative privileges. to do that, just got to All Programs > Accessories > Command Prompt but right click on Command prompt and select 'Run as Administrator'
so i can use this command:
DOS Command:
mklink /D D:\LINK C:\TARGET
notice the the /D option is to tell the command i am linking a direcotry, if you leave it out, the utility will create a file link by default, but since i am creating a directory symbolic link, i use the /D option
if you open explorer, you should see a shortcut icon, you can right click and select properties to confirm the target:
NOTE:i tried the same command in windows xp, but did not get the same results, instead i get this message: 'mklink' is not recognized as an internal or external command, operable program or batch file
ALSO, if you get this error:
You do not have sufficient privilege to perform this operation.
you need to open the DOS command with administrative privileges. to do that, just got to All Programs > Accessories > Command Prompt but right click on Command prompt and select 'Run as Administrator'