Questions about setting environment variables the PATH are very common here, and in most cases the answers are very similar to each other. In the future it would be nice to have a good Q/A for this. So the question is: How do I set the executable PATH and other environment variables on major operating systems? A good answer would include a simple explanation of what environment variables and especially PATH mean to the OS, as well as simple guidelines on how to set them accordingly.
Being an avid computer user for years now, the PATH is something that has crossed me quite a few times now. So when I saw this question, it was time to put my learning hat on.
One of the most well-known is called
PATHon Windows, Linux and Mac OS X. It specifies the directories in which executable programs* are located on the machine that can be started without knowing and typing the whole path to the file on the command line. (Or in Windows, the Run dialog in the Start Menu or Windows Key+R).
So now that we know what the PATH is, where are these things set? With a quick look around, I found it was easily found on Windows 7, by simply popping open the Start Menu and typing in “Environment.” The first option was Edit environment variables for your account. Click it, and here we are:
Let’s say I wanted to add my own, for a folder I frequently visit. I shall use eclipse for example. Currently my eclipse folder is located in C:UsersSimoneclipse. I hit NEW, and add in this:
Our variable is Eclipse, and the value is where the folder is located. When i now open my start menu, I can do this:
I can also use it in command prompt to get to a folder faster:
This is just the start of what can be done with the system variables. And fear not! This is for Mac and Linux too! Just take a look at the rest of the great answers provided by our SuperUsers.
Filed under Question of the Week