How do you make a symbolic link with a relative path using mklink?

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