I remember the first time I encountered a solution that went something like: “All you need to do is add it to your PATH variable.” Huh? What is a PATH variable?

The PATH variable is just that, a variable. More specifally, it is an environment variable that is used across both Windows and Unix operating systems. Wikipedia has a halfway decent definition:

PATH is an environment variable on Unix-like operating systems, DOS, OS/2, and Microsoft Windows, specifying a set of directories where executable programs are located. In general, each executing process or user session has its own PATH setting.

Wikipedia, PATH (variable)

Still, this definition merits a bit more explanation.

Without the PATH variable, we would need to run programs using absolute paths. The PATH variable prevents us from having to write out the entire path to a program on the CLI every time we run it. Essentially, it’s just a variable that stores a bunch of shortcuts.

When you enter a command on the CLI without using the absolute path, the operating system checks the PATH variable. It reads through values assigned to the PATH variable from left to right — Unix seprates values with :, Windows with ; — until it finds the value that contains the path to your program. If it does not find the path, well then… “All you need to do is add it to your PATH variable.”

Here is how to add a value to your PATH variable in Windows.

Posted by: John Dugan