How to create an NTFS junction?

21

3

How can I create an NTFS junction point in Windows XP?

jemila Ali

Posted 2010-05-28T09:34:15.560

Reputation:

Answers

11

By default Windows XP dosn't have tools to make junction point. This tool (linkd) is part of Windows Resource Kit Tools.

Another tool is junction by Mark Russinovich.

Maxim Welikobratov

Posted 2010-05-28T09:34:15.560

Reputation: 211

When I try to create a symlink to a remote folder, I get the error "Cannot create a link at: [foldernamehere]". An empty folder is created, but no link. – Aaron Franke – 2017-02-28T04:14:05.083

7

Try junction utility from Sysinternals, it's available on W2k+

Yakeen

Posted 2010-05-28T09:34:15.560

Reputation:

Note: This tool only allows you to link local volumes. You can't symlink to a remote location. – Aaron Franke – 2017-02-28T03:46:13.187

I.e. it does not support the symbolic link proper, but only the “directory junction” — an older form of NTFS reparse point developed for Windows 2000. – can-ned_food – 2017-10-14T04:12:36.693

6

Is your definition of junction point a directory that is hardlinked to another one?

If so it is simple

mklink /J <new directory to be linked> <target directory>

After this there is no distinction between the directories. They have the same MFT_REF (from http://en.wikipedia.org/wiki/NTFS_symbolic_link).

fsutil can also be helpful to query reparse-points and make hardlinks.

If you wanted to know how to programmatically do this, you can us NTFS storage driver IOCTL calls on the volume handle. But it would be easier to just call mklink.

Be advised that you have to have write and modify privileges for the target directory. You will need to run cmd.exe elevated for it to work.

Dominik Weber

Posted 2010-05-28T09:34:15.560

Reputation: 285

NTFS Junctions do not actually provide multiple references to MFT items. Thinking that they are exactly like multiple hardlinks with file nodes is a misconception — one which I also shared until recently. They are simply reparse tags on directory nodes. You can test this by making a directory junction and then using fsutil reparsepoint delete the_directory-junction_you_made_to_test_this. You will have a distinct and probably empty directory node. – can-ned_food – 2017-10-14T05:34:40.980

19mklink doesn't exist on winxp, I believe. – skaffman – 2010-08-23T19:48:20.700

5mklink introduced in Vista – None – 2012-07-11T18:36:17.313

3

You may also use Link Shell Extension as a GUI-oriented interface. It can create junctions, hard links and even symlinks on Windows XP if you install the NTFS 5 filter driver from Masatoshi Kimura as described. http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html

Toughy

Posted 2010-05-28T09:34:15.560

Reputation: 133

1

Here's the "live" link for junction.exe.

http://live.sysinternals.com/junction.exe

Orwellophile

Posted 2010-05-28T09:34:15.560

Reputation: 451

1

NATIVE Windows XP, 7, & 8 COMMAND:

Directory Junction:
mklink /J <oldpath(link)> <newpath(target)>

Making the newpath absolute, you'll be able to move link without breaking the pointer to the newpath. If you make the newpath relative, you'll be able prevent breaking the link, as long as you move BOTH the link and target TOGETHER and maintain their relative paths.

BenH

Posted 2010-05-28T09:34:15.560

Reputation: 189

4mklink is not native to xp - it was only introduced on Vista. – cup – 2015-11-07T17:40:34.150

0

You create junction point with

REPARSE_MOUNTPOINT_DATA_BUFFER* pReparseInfo = // ...
pReparseInfo->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
// ...
DeviceIoControl(..., FSCTL_SET_REPARSE_POINTFSCTL_SET_REPARSE_POINT, pReparseInfo, ... 

API call. pReparseInfo points to REPARSE_MOUNTPOINT_DATA_BUFFER structure you need to provide.

MSDN article has a community provided code snippet at the bottom of the page that shows how to use the API.

Roman R.

Posted 2010-05-28T09:34:15.560

Reputation: 133

0

You can make NTFS junction with special software. I recommend Link Shell Extension (LSE). It is freeware and easy to use. It also has good documentation with screenshots of all steps.

vasili111

Posted 2010-05-28T09:34:15.560

Reputation: 479