2

So many times, I would like to add a directory to the PATH in windows. And I think the GUI for it must be the must stupid GUI ever developed in windows, yet it's there since ages, in an unmodified form till in Windows 7.

My question is, that do you know any freeware tiny application which could let me do something like:

  • add current dir to path
  • edit path directories

To a context menu, for example? If you have a custom solution using Total Commander, it's equally as good, as thats where I spend most of my time...

2 Answers 2

1

There may be more elegant solutions possible (this is a little kludgy), but off the top of my head:

  • Download this program and extract to c:\wherever

  • To automate things a bit, you could add a right-click context menu for folders that points to that program (these instructions are for XP):

    • Start, Run, Regedit (be careful, backup your machine first, etc. etc.)
    • Go to HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell
    • Right click on shell and choose "New Key"
    • Type PathMgr enter
    • Right click on PathMgr and choose "New Key"
    • Type command enter
    • Click on command
    • Double-click on (Default)
    • Type c:\wherever\pathmgr.exe enter
  • Then in the future you can either:

    • Right-click on a folder and choose PathMgr and edit away

Or, to add a folder:

  • Right-click on the folder you want to add and choose "Copy"
  • Right-click on the folder again, choose PathMgr
  • Click on the insert button to insert a new path
  • Right click on the new path entry you created and choose Modify, via Paste
  • Apply, Exit
0

I have adapted this answer from an out of date blog post where the links don't work, so I will provide all the instructions you need here.

Source: http://www.addictivetips.com/windows-tips/add-remove-any-folder-to-path-variable-using-context-menu/

WARNING: This procedure involves registry editing. If you are not comfortable editing the registry, turn back now. As you probably know, you can cause serious problems in the registry.

This procedure is written to work on Windows 7 or 8. I can't say how it will work outside of those versions.

  1. Download the GTools utility pack from here: http://p-nand-q.com/download/gtools/

    It's really just the "pathed.exe" tool you're looking for. For the purposes of this effort, you can remove everything else that's included in GToools.

  2. Install the GTools or just place the pathed.exe file somewhere convenient and permanent.

  3. Determine the path to the pathed.exe file. You will need it shortly.

  4. Add a key to the windows registry at the following path:

    "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\"

    Call it something that makes sense like "Add To Path"

  5. Add another key under that key, called "command".

  6. Within that key, set the default value similar to the following:

    "C:\Program Files (x86)\GTools\pathed.exe" /APPEND "%0" /USER

    Remember that it must be set with exactly this format. The quotes are very important.

    Where "C:\Program Files (x86)\GTools\" represents wherever you ended up putting the pathed.exe file.

  7. Add another key to the windows registry at the following path:

    "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\"

    Call it something that makes sense like "Remove From Path"

  8. Add another key under that key, called "command".

  9. Within that key, set the default value similar to the following:

    "C:\Program Files (x86)\GTools\pathed.exe" /REMOVE "%0" /USER

    Remember that it must be set with exactly this format. The quotes are very important.

    Where "C:\Program Files (x86)\GTools\" represents wherever you ended up putting the pathed.exe file.

  10. Restart windows or go into task manager and restart "Windows Explorer" (a.k.a. explorer.exe)

    This step is required to get Explorer to recognize the new context menu entries.

This places the chosen directory into the "User" path. Meaning it is specific to you. So, this will not affect other users.

It is important to note, that using this setup, it is easy to clutter up your user path, by placing directories in it multiple times. This doesn't have any real negative effect. It's just messy. This problem is easily resolved by using "Remove From Path" on any directory prior to using "Add To Path" on it. This would remove any prior entries of that directory and you would only end up with the one.

I think based on this, you can also figure out how to use pathed to place itself in the path, thereby allowing you to easily add directories to the path from the command line as well.

Should you ever wish to remove these context menu options, simply reverse the process.

Not the answer you're looking for? Browse other questions tagged .