WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Create Junction Points

 Keywords: ntfs junction points folder directory junctions symbolic link reparse points mklink.exe linkd.exe Vista Win7 Win8 Win2k8

Question:

Is anyone willing to share a script to create ntfs junction points?

Answer:

I just run the linkd.exe utility from WinBatch. Linkd is included in the Windows Server 2003 Resource Kit Tools: http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en

Here's some more info: http://support.microsoft.com/?kbid=205524


On Vista and Newer
The utility is built-in as a command line tool and is named "MKLINK.EXE". You have the option to create Unix-style symbolic links for both files and directories. Directory Junctions are functionally equivalent to a directory symbolic link, and Win2K3 & older can only create directory Junctions. Both Directory Junctions and Symbolic Links are implemented as Reparse Points in NTFS.

In fact, symbolic links are just a single simple Windows API call away on Win2k8/Vista and newer http://msdn.microsoft.com/en-us/library/aa363866.aspx

Creating a junction in WinBatch is very easy on Vista and newer:

cmd_64 = DirWindows(0):'Sysnative\CMD.EXE'
ShellExecute(cmd_64, '/c mklink /J myjunction "':DirWindows(0):'system32"', '', @NORMAL, '')

Article ID:   W17919
Filename:   Create Junction Points.txt
File Created: 2014:06:25:12:50:44
Last Updated: 2014:06:25:12:50:44