windows 7 - How can I create a right click menu item to manipulate a junction point?

26
2013-08
  • Tom Wijsman

    As I am using a SSD but it is limited in size I want to be able to use junction points to remap files and directories to my HDD, this would work ideal if I could create a shell extension for it that does this.

    The ideal behavior would be to right click a directory or junction point and have an option
    "Manipulate junction point" in which I can perform the following actions:

    • Create: For a directory, move the directory to a location I specify and replace it by a junction point.
      (Dir) C:\Example turns into (JP) C:\Example --> D:\Example

    • Swap: For a junction point, I want to swap the junction point with its location.
      (JP) C:\Example --> (Dir) D:\Example turns into (Dir) C:\Example <-- (JP) D:\Example

      This means it would remove the junction point, move the data and place a reverse junction point.

    • Remove: For a junction point, I want to remove it and move the directory back.
      (JP) C:\Example --> (Dir) D:\Example turns into (Dir) C:\Example

    My most important questions:

    • What approach should I take to do this? Script? Bash? Executable?
    • How do I create the menu entry?

    Less important questions:

    • Does there exist such a solution already?
    • Are there better commands or API calls for checking and manipulating junction points?

    I already know of Microsoft's mklink and Sysinternals junction.

  • Answers
  • Isxek

    Since you asked if such solutions exist already, have you taken a look at Junction Link Magic or Link Shell Extension?

    Junction Link Magic allows creation, modification, and removal of junction points. It is freeware, and does support Windows 7.

    Link Shell Extension also provides the same functionality, and is also freeware. It also supports Windows 7.

  • Randolph West

    I just use MKLINK which is built into Windows 7. You'll end up writing batch files I guess, but it's not hard to use.


  • Related Question

    windows 7 - How to (re)enable the "New" context menu items for an administrator when right-clicking in a folder and selecting New > X?
  • Metro Smurf

    I just migrated from XP x86 to Win7 x64 (clean install). I had a couple of data drives in my XP x86 system that I physically moved to my Win7 x64 system.

    When browsing a directory in any of the transferred drives, the only option available in the 'new' context menu is "Folder", i.e., Right-Click inside a folder > New > Folder (this is similar behavior for Win7 when using the context menu in c:\Program Files):

    alt text

    However, whenever creating a new folder within any of the directories, all the context menu new items are available within the new folder:

    alt text

    Steps I've taken that have failed to add the new context menu items:

    • Removing all security permissions from a directory and sub-directories. Replacing them with new permissions. As well as removing inheritable permissions from the parent.
    • Taking explicit ownership of a directory and sub-directories.
    • Combing the above two.

    Sample of Effective Permissions that do not work:

    alt text

    Steps I've taken that have succeeded to add the new context menu items:

    • Adding the "Everyone" group to the drive and giving the group explicit "Modify" privileges.
      • Giving the "Everyone" group explicit privileges smells wrong. I'm an administrator on my system; why should I have to add the "Everyone" group as well?
    • Adding my username to the drive and giving full permissions.
      • Again, since I'm an administrator on my system and the administrators group already has full control of the drive/directories/folders, why should I have to explicitly add my user name to the security permissions?

    Finally, The Question:

    Is it possible to have the New Item context menu have all available options by default without having to explicitly add the everyone group or a specific user name to the security permissions?

    I'm suspecting that the option may not be available unless the username is explicitly added to the security permissions.

    Of note: I've seen the registry hacks for updating the new items context menu; my preference is to avoid such hacks and return the functionality to the expected behavior an administrator should have.


  • Related Answers
  • Ali

    I believe the issue is who owns the folder. Try clicking the owner tab press Edit and change the owner to yourself. Remember to tick the box "Replace owner on subcontainers and objects" before applying.

  • Metro Smurf

    OK, I've finally figured out what the issue is with Win7. Apparently, when you migrate a drive to a Win7 (or Vista) system, an administrator does not have full privileges as described in my question.

    Here's what needs to be done:

    1. Change ownership of the drive to yourself (or the administrators group) and then apply the ownership changes to sub-containers and objects.
    2. Change permissions of the drive with the following permissions (delete all others if you want):
      • Administrators: Full Control
      • System: Full Control
      • Users: Read & Execute
      • Authenticated Users: Modify <---- This is the key group!

    Even if you are an admin and own the drive, you will not be able to add a "new item" to an existing folder via the context menu until the group "Authenticated Users" has been added to the drive permissions.

    The other alternative is to provide your user account Full Control to the drive, however, using the Authenticate Users group is likely to be a better practice in the long run.