Take the 2-minute tour ×

There is CreateHardLink function to create Hardlinks.(Since Win2000)
And There is CreateSymbolicLink function since Vista has been released.

But why isn't there a CreateJunction?

How does mklink make a junction?
And How do I write codes to make junction in my app?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

They're reparse points, so FSCTL_SET_REPARSE_POINT is the magic FSCTL. Here's an example, never tried it but seems right:



share|improve this answer
Note that, starting from Windows Vista/Server 2008, the CreateSymbolicLink function can also be used. –  efotinis Dec 12 '10 at 17:48
add comment

There's currently no built-in single function for creating junctions like there is for symbolic links or hard links. Like snoone said, it's a reparse point, so you have to use DeviceIoControl to interact with it. If I remember correctly, the source he linked is the same source I played around with when I was trying to figure this out, and I don't think I ran into any issues with it.

Alternatively, if you're not against using an external library in your application, and you're going to need functionality for reading/checking/deleting junctions, you might want to look into reparselib, which is a pretty decent library wrapping junctions, symbolic links, mount points, and custom reparse points.

share|improve this answer
add comment

Your Answer


