Junction points with network drives


Ever wanted to create a 'junction point' style pointer but using a network drive as the source?  Now you can!


With Windows XP you can create junction points on your disks but the prerequisite is that the source point is on your local disk.  This is no good if you need to create the junction point that refers the user from a point that is anywhere else, for example a network drive.  This is actually very simple to do and has existed in Windows since Windows 98 (I think, but don't quote me on that...).  All you need to do is to create a desktop.ini file and a target.lnk file and you are all done.  The contents of the desktop.ini file should be:




[.ShellClassInfo]")
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}


 The target.lnk file you can either create manually or use the following VBS script:




 Set oWS = WScript.CreateObject("WScript.Shell")
 sLinkFile = MYPATHFORFILE & "\target.lnk"
 Set oLink = oWS.CreateShortcut(sLinkFile)
 oLink.TargetPath = SOURCEPATHTOBEREDIRECTED
 oLink.WorkingDirectory = DESTINATION
 oLink.Save


The only downside is that this solution also has a prerequisite.  The application that you want to follow the redirection must use Shell32.dll for it's file handling.  Seeing as most applications now do this should not be too great a problem for you.

Comments (7)
  1. doxley says:

    Ooops, sorry!  You should create the files in the folder that you want to redirect.  For example, if you want to redirect the network folder H:MyFolder to D:MyFolder, you put the file in H:MyFolder.

    Hope that makes it clearer.

  2. doxley says:

    As long as the application you use makes use of Shell32.dll then it should be possible.  I have used this script to redirect a network folder to a local folder with no problem.

    Daniel

  3. alex says:

    i want to map a local folder to a remote folder(in different machines), like a remote symbolic link, i can do it?

  4. EDDIE says:

    "create a desktop.ini file and a target.lnk"

    You don’t say WHERE to create them.

  5. Phil says:

    You should add that you have to set system attribute (attrib +s …) to the folder and its files.

    And yes, you can redirect a network folder to a local folder and vice versa BUT this will not work programs that access this folder for saving data. It only works if you navigate manually to this folder (in the explorer or in some sort of “Save as”-dialogue).

  6. Ken says:

    Need to also add the system attribute to desktop.ini and the target folder using the attrib command. (attrib +s [FOLDERNAME])

  7. Roger says:

    Could anyone please write how to do that stuff for newbe. I dont know how use script.

Comments are closed.

Skip to main content