Right now, it's such a mess. Every time I install a new program that does something trivial in the command line, I have to add it to the path. In fact, I'm developing on Ruby and even gems (plugins/extensions) sometimes have their own executables, and are stored in different folders and I end up having to add several paths per application, as well. It's gotten to the point that I am pushing thirty paths in my PATH environment variable.

I'm cautious to copying and pasting them to a home folder of sorts and setting path to that; it just feels wrong. Is there an established best practice that I am missing?

link|improve this question

50% accept rate
feedback

2 Answers

up vote 5 down vote accepted

A number of small self-contained utilities reside in my %UserProfile%\Apps folder, such as archivers and the like. Then there are a number of batch files I wrote and frequently use which reside in %UserProfile%\Batches. For the rest, I just add them to the PATH, which is either done by an installer or with

setx PATH "%PATH%;%CD%"

from the appropriate directory. The number of paths there should probably only ever become an issue if the contents get too long (there are length limits for environment variables).

You can (and I sometimes do) write small wrapper batch files for such programs. Simply copying/hardlinking/symlinking the executable into another directory will likely not work on Windows but you can easily create a batch file, for example for the program Foo:

@"%ProgramFiles%\Foosoft Foo\foo.exe" %*

and you can then add the folder where you store those batch files to your PATH.

link|improve this answer
+1 for batch file – TuxGeek Jun 23 '10 at 7:40
How do these wrapper batch files work? Do they work exactly as requiring the actual path? If so, this is amazing. – Justin L. Jun 23 '10 at 8:36
@Justin: They just delegate all arguments given to the batch file to the actual program. Where that resides you'll have to know yourself. – Joey Jun 23 '10 at 8:57
Hm; I should clarify -- is there any functional difference between adding the binary's directory to PATH and creating a wapper batch file of the binary into a custom directory that is on the PATH? – Justin L. Jun 23 '10 at 9:18
@Justin: If you use the batch files in batch files again, then there is. Aside from that I'm not aware of any. – Joey Jun 23 '10 at 10:03
show 2 more comments
feedback

I am not sure about any specific best practices. But I prefer using GUI PATH Editor tools to manage PATH variables. So that it can be clearly maintained.

List of PATH Editor -

Rapid Environment Editor

Redmond PATH Editor

link|improve this answer
Graphical editors might make things a lot easier heh – Justin L. Jun 23 '10 at 18:36
That Redmond PATH editor is exactly the sort of thing I was looking for. +1 – Nathan Ridley Aug 19 '10 at 11:27
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.