windows 10, 8, 7, and vista all support symbolic links, also known as symlinks, that point to a file or folder on your system.
symbolic links are basically advanced shortcuts. create a symbolic link to an individual file or folder, and that link will appear to be the same as the file or folder to windows—even though it’s just a link pointing at the file or folder.
for example, let’s say you have a program that needs its files at c:\program. you’d really like to store this directory at d:\stuff, but the program requires that its files be at c:\program. you could move the original directory from c:\program to d:\stuff, and then create a symbolic link at c:\program pointing to d:\stuff. when you relaunch the program, it will try to access its directory at c:\program. windows will automatically redirect it to d:\stuff, and everything will just work as if it were in c:\program.
this trick can be used for all sorts of things, including syncing any folder with programs like dropbox, google drive, and onedrive.
there are two type of symbolic links: hard and soft. soft symbolic links work similarly to a standard shortcut. when you open a soft link to a folder, you will be redirected to the folder where the files are stored. however, a hard link makes it appear as though the file or folder actually exists at the location of the symbolic link, and your applications won’t know any better. that makes hard symbolic links more useful in most situations.
you can create symbolic links using the mklink command in a command prompt window as administrator. to open one, locate the “command prompt” shortcut in your start menu, right-click it, and select “run as administrator”.
on windows 10’s creators update, you can use a normal command prompt window, without running it as an administrator. however, to do this without an administrator command prompt window, you must first enable developer mode from settings > update & security > for developers.
c:\>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 refers to.
without any extra options, mklink creates a symbolic link to a file. the below command creates a symbolic, or “soft”, link at link pointing to the file target :
mklink link target
use /d when you want to create a soft link pointing to a directory. like so:
mklink /d link target
use /h when you want to create a hard link pointing to a file:
mklink /h link target
use /j to create a hard link pointing to a directory, also known as a directory junction:
mklink /j link target
so, for example, if you wanted to create a hard link at c:\linktofolder that pointed to c:\users\name\originalfolder, you’d run the following command:
mklink /j c:\linktofolder c:\users\name\originalfolder
you’ll need to put quotation marks around paths with spaces. for example, if the folders are instead named c:\link to folder and c:\users\name\original folder, you’d use the following command instead:
mklink /j "c:\link to folder" "c:\users\name\original folder"
if you get the error message location is not available the symbolic link cannot be followed because its type is disabled, then run a command prompt window as administrator and run the following commands.
c:\windows\system32>fsutil behavior query symlinkevaluation local to local symbolic links are enabled. local to remote symbolic links are disabled. remote to local symbolic links are enabled. remote to remote symbolic links are disabled.
this will show you whether or not symlinks are disabled on your system or not.
to enable all directions for the symlinks enter this command:
fsutil behavior set symlinkevaluation l2l:1 l2r:1 r2l:1 r2r:1
now run the query again and you should see the following:
c:\windows\system32>fsutil behavior query symlinkevaluation local to local symbolic links are enabled. local to remote symbolic links are enabled. remote to local symbolic links are enabled. remote to remote symbolic links are enabled.
you should be able to traverse your new symbolic directory file/directory as normal. if not, check your local security policy (secpol.msc) settings for the user account performing the linking:
when you're a little too careless about virtualizing your domain controllers, cloning, migrating, backing up and restoring, returning from vacation… Read More
systemd is new service manager for linux. it's a replacement for all previous init systems (sysv/sysvinit & ubuntu's upstart) and… Read More