This web page implies that it is possible to make symbolic links with relative paths using mklink.
I have tried all sorts of ways to make relative symbolic links, but I always end up with an absolute path.
How is it done?
This web page implies that it is possible to make symbolic links with relative paths using mklink.
I have tried all sorts of ways to make relative symbolic links, but I always end up with an absolute path.
How is it done?
Symbolic links are relative by default. You have to explicitly write a drive letter to make any part of the link absolute.
The general syntax for a symbolic link is:
mklink link destination
So, to create a relative symbolic link: link is going to be a path relative to your working directory, and destination is going to be a path relative to link.
Examples:
1. mklink link.txt ..\destination.txt
This creates a symbolic link for link.txt which points to destination.txt one folder up.
You can move link.txt around, and it will always point to destination.txt one folder up.
2. C:\>mklink A\Link.txt ..\Destination.txt
This creates a symbolic link C:\A\Link.txt for C:\Destination.txt
To make relative link to a directory use /D switch
For example:
mklink /D lib\foo ..\foo
Links directory foo from parent directory as lib\foo.
When the link is moved to another directory, it will still point to ..\foo in a relative sense.
Junctions created using /J switch can have relative path specified at the time of creation, however this path is resolved and junction will always point to an absolute path.