A junction is a directory symbolic link where C:\Link
can redirect to D:\Target
, for example. A mount point lets you redirect a directory to the root of an entire volume, so that C:\volume
can redirect to volume D:
(or a volume that has no drive letter assigned to it).
So when you create a junction in Windows, it looks like this:
C:\myLinks> dir
2021/11/26 16:41 <JUNCTION> MyFolderToDriveA [A:]
But when you mount a partition, it looks like this:
C:\myMounts> dir
2021/11/26 16:42 <JUNCTION> MyFolderToDriveA [\??\Volume{0d7bf636-0000-0000-0000-60e00f000000}\]
What I would like is to create a link to a folder on another volume:
C:> MKLINK /J C:\MyLink A:\MyTarget
Junction created for C:\MyLink <<===>> A:\MyTarget
C:> DIR
2021/11/26 16:43 <JUNCTION> MyLink [A:\MyTarget]
However, when you start another system or switch the mount order (such as opening Google Drive or plugging a pendrive), the volume drive may change letter. So I would like something similar to this:
<JUNCTION> MyLink [\??\Volume{0d7bf636-0000-0000-0000-60e00f000000}\MyTarget]
There are a lot of tools like diskpart
, wmic
, fsutil
, net use
, subst
, but I don't think any of them can help me unless there is some workaround.
My solution was to do it as follows:
25/11/2021 16:41 <JUNCTION> MyDriveA [\??\Volume{0d7bf636-0000-0000-0000-60e00f000000}\]
25/11/2021 17:20 <JUNCTION> MyLink [C:\MyDriveA\MyTarget]
C:
will almost never change. But isn't there some way to create a junction referring to the volume ID?